[Cloud-init-dev] cloud-init 0.7.6 released

2014-10-10 Thread Scott Moser
Hello all,

I released 0.7.6 of cloud-init today.
Source tarball is available for download from
  https://launchpad.net/cloud-init/trunk/0.7.6

Thanks to all that contributed.

Cloud-init 0.7.6 contains bug fixes and improvements including:
 - much improved freebsd support, including support for OpenStack
   ConfigDrive.
 - jinja2 as templating engine, dropping requirement on cheetah
 - systemd improvements
 - fixes for consumption of vendor-data on OpenStack.

The full change log is below.

 - Enable vendordata on CloudSigma datasource (LP: #1303986)
 - Poll on /dev/ttyS1 in CloudSigma datasource only if dmidecode says
   we're running on cloudsigma (LP: #1316475) [Kiril Vladimiroff]
 - SmartOS test: do not require existance of /dev/ttyS1. [LP: #1316597]
 - doc: fix user-groups doc to reference plural ssh-authorized-keys
   (LP: #1327065) [Joern Heissler]
 - fix 'make test' in python 2.6
 - support jinja2 as a templating engine. Drop the hard requirement on
   cheetah. This helps in python3 effort. (LP: #1219223)
 - change install path for systemd files to /lib/systemd/system
   [Dimitri John Ledkov]
 - change trunk debian packaging to use pybuild and drop cdbs.
   [Dimitri John Ledkov]
 - SeLinuxGuard: remove invalid check that looked for stat.st_mode in
   os.lstat.
 - do not write comments in /etc/timezone (LP: #1341710)
 - ubuntu: provide 'ubuntu-init-switch' module to aid in systemd testing.
 - status/result json: remove 'end' entry which was always null
 - systemd: make cloud-init block ssh service startup to guarantee keys
   are generated. [Jordan Evans] (LP: #1333920)
 - default settings: fix typo resulting in OpenStack and GCE not working
   unless config explicitly provided (LP: #1329583) [Garrett Holmstrom])
 - fix rendering resolv.conf if no 'options' are provided (LP: #1328953)
 - docs: fix disk-setup to reference 'table_type' [Rail Aliiev] (LP:
   #1313114)
 - ssh_authkey_fingerprints: fix bug that prevented disabling the module.
   (LP: #1340903) [Patrick Lucas]
 - no longer use pylint as a checker, fix pep8 [Jay Faulkner].
 - Openstack: do not load some urls twice.
 - FreeBsd: fix initscripts and add working config file [Harm Weites]
 - Datasource: fix broken logic to provide hostname if datasource does not
   provide one
 - Improved and less verbose logging.
 - resizefs: first check that device is writable.
 - configdrive: fix reading of vendor data to be like metadata service
   reader.  [Jay Faulkner]
 - resizefs: fix broken background resizing [Jay Faulkner] (LP: #1338614)
 - cc_grub_dpkg: fix EC2 hvm instances to avoid prompt on grub update.
   (LP: #1336855)
 - FreeBsd: support config drive datasource [Joseph bajin]
 - cc_mounts: support creating a swap file


___
Mailing list: https://launchpad.net/~cloud-init-dev
Post to : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp


[Cloud-init-dev] [Merge] lp:~harlowja/cloud-init/better-chef-module into lp:cloud-init

2014-10-10 Thread Joshua Harlow
Joshua Harlow has proposed merging lp:~harlowja/cloud-init/better-chef-module 
into lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~harlowja/cloud-init/better-chef-module/+merge/238040


Increase the robustness of the chef module

Add the following adjustments to the chef template and module

- Make it so that the chef directories can be provided (defaults
  to the existing directories)
- Make the params much more configurable, and if a parameter is
  provided in the chef configuration it will override existing template
  parameters.
- Make the template skip lines if the values are None in the configuration
  so that template lines can be removed if/when this is desirable.
- Allow the firstboot json path to be configurable (defaults to the
  existing location).
- Adds a basic set of tests to ensure that good things are happening.
-- 
https://code.launchpad.net/~harlowja/cloud-init/better-chef-module/+merge/238040
Your team cloud init development team is requested to review the proposed merge 
of lp:~harlowja/cloud-init/better-chef-module into lp:cloud-init.
=== modified file 'cloudinit/config/cc_chef.py'
--- cloudinit/config/cc_chef.py	2014-08-26 18:50:11 +
+++ cloudinit/config/cc_chef.py	2014-10-11 00:35:26 +
@@ -18,6 +18,8 @@
 #You should have received a copy of the GNU General Public License
 #along with this program.  If not, see http://www.gnu.org/licenses/.
 
+from datetime import datetime
+
 import json
 import os
 
@@ -38,6 +40,61 @@
 
 OMNIBUS_URL = https://www.opscode.com/chef/install.sh;
 
+CHEF_RB_TPL_DEFAULTS = {
+# These are ruby symbols...
+'ssl_verify_mode': ':verify_none',
+'log_level': ':info',
+# These are not symbols...
+'log_location': '/var/log/chef/client.log',
+'validation_key': /etc/chef/validation.pem,
+'client_key': /etc/chef/client.pem,
+'json_attribs': /etc/chef/firstboot.json,
+'file_cache_path': /var/cache/chef,
+'file_backup_path': /var/backups/chef,
+'pid_file': /var/run/chef/client.pid,
+'show_time': True,
+}
+CHEF_RB_TPL_BOOL_KEYS = frozenset(['show_time'])
+CHEF_RB_TPL_KEYS = list(CHEF_RB_TPL_DEFAULTS.keys())
+CHEF_RB_TPL_KEYS.extend(CHEF_RB_TPL_BOOL_KEYS)
+CHEF_RB_TPL_KEYS.extend([
+'server_url',
+'node_name',
+'environment',
+'validation_name',
+])
+CHEF_RB_TPL_KEYS = frozenset(CHEF_RB_TPL_KEYS)
+CHEF_RB_PATH = '/etc/chef/client.rb'
+CHEF_FB_PATH = '/etc/chef/firstboot.json'
+
+
+def get_template_params(iid, chef_cfg, log):
+params = CHEF_RB_TPL_DEFAULTS.copy()
+params.update({
+'server_url': chef_cfg['server_url'],
+'node_name': util.get_cfg_option_str(chef_cfg, 'node_name', iid),
+'environment': util.get_cfg_option_str(chef_cfg, 'environment',
+   '_default'),
+'validation_name': chef_cfg['validation_name'],
+})
+# Allow users to overwrite any of the keys they want (if they so choose),
+# when a value is None, then the value will be set to None and no boolean
+# or string version will be populated...
+for (k, v) in chef_cfg.items():
+if k not in CHEF_RB_TPL_KEYS:
+log.debug(Skipping unknown chef template key '%s', k)
+continue
+if v is None:
+params[k] = None
+else:
+# This will make the value a boolean or string...
+if k in CHEF_RB_TPL_BOOL_KEYS:
+params[k] = util.get_cfg_option_bool(chef_cfg, k)
+else:
+params[k] = util.get_cfg_option_str(chef_cfg, k)
+params['generated_on'] = datetime.now().isoformat()
+return params
+
 
 def handle(name, cfg, cloud, log, _args):
 
@@ -49,7 +106,7 @@
 chef_cfg = cfg['chef']
 
 # Ensure the chef directories we use exist
-for d in CHEF_DIRS:
+for d in chef_cfg.get('directories', CHEF_DIRS):
 util.ensure_dir(d)
 
 # Set the validation key based on the presence of either 'validation_key'
@@ -64,26 +121,26 @@
 template_fn = cloud.get_template_filename('chef_client.rb')
 if template_fn:
 iid = str(cloud.datasource.get_instance_id())
-params = {
-'server_url': chef_cfg['server_url'],
-'node_name': util.get_cfg_option_str(chef_cfg, 'node_name', iid),
-'environment': util.get_cfg_option_str(chef_cfg, 'environment',
-   '_default'),
-'validation_name': chef_cfg['validation_name']
-}
-templater.render_to_file(template_fn, '/etc/chef/client.rb', params)
+params = get_template_params(iid, chef_cfg, log)
+templater.render_to_file(template_fn, CHEF_RB_PATH, params)
 else:
-log.warn(No template found, not rendering to /etc/chef/client.rb)
+log.warn(No template found, not rendering to %s,
+ CHEF_RB_PATH)
 
-# set the firstboot json

[Cloud-init-dev] [Merge] lp:~harlowja/cloud-init/test-fixups into lp:cloud-init

2014-10-10 Thread Joshua Harlow
Joshua Harlow has proposed merging lp:~harlowja/cloud-init/test-fixups into 
lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~harlowja/cloud-init/test-fixups/+merge/238042

Fix some of the erroring out test cases
-- 
https://code.launchpad.net/~harlowja/cloud-init/test-fixups/+merge/238042
Your team cloud init development team is requested to review the proposed merge 
of lp:~harlowja/cloud-init/test-fixups into lp:cloud-init.
=== modified file 'tests/unittests/test_datasource/test_openstack.py'
--- tests/unittests/test_datasource/test_openstack.py	2014-09-11 01:17:40 +
+++ tests/unittests/test_datasource/test_openstack.py	2014-10-11 01:57:29 +
@@ -318,7 +318,7 @@
 self.assertIsNone(ds_os.version)
 
 
-class TestVendorDataLoading(unittest.TestCase):
+class TestVendorDataLoading(test_helpers.TestCase):
 def cvj(self, data):
 return openstack.convert_vendordata_json(data)
 

=== modified file 'tests/unittests/test_distros/test_netconfig.py'
--- tests/unittests/test_distros/test_netconfig.py	2014-10-02 20:45:08 +
+++ tests/unittests/test_distros/test_netconfig.py	2014-10-11 01:57:29 +
@@ -182,6 +182,12 @@
   spec=False, passthrough=False)
 load_mock = self.mocker.replace(util.load_file,
 spec=False, passthrough=False)
+subp_mock = self.mocker.replace(util.subp,
+spec=False, passthrough=False)
+
+subp_mock(['ifconfig', '-a'])
+self.mocker.count(0, None)
+self.mocker.result(('vtnet0', ''))
 
 exists_mock(mocker.ARGS)
 self.mocker.count(0, None)
@@ -190,6 +196,7 @@
 write_bufs = {}
 read_bufs = {
 '/etc/rc.conf': '',
+'/etc/resolv.conf': '',
 }
 
 def replace_write(filename, content, mode=0644, omode=wb):

___
Mailing list: https://launchpad.net/~cloud-init-dev
Post to : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp