From e8536d7ee30c0ce0c80a83ead8d475a724fd0d32 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 13 Aug 2014 13:47:58 -0400 Subject: remove un-used 'end' in result.json and status.json --- ChangeLog | 1 + 1 file changed, 1 insertion(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 296a15cd..8242ff12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ - 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 0.7.5: - open 0.7.5 - Add a debug log message around import failures -- cgit v1.2.3 From d8c8a87f9b4c314bc39f5987602c02d3861f329f Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 21 Aug 2014 14:04:25 -0400 Subject: settings: fix typo resulting in OpenStack and GCE not running. LP: #1329583 --- ChangeLog | 2 ++ cloudinit/settings.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index c52d83b7..4d8d6427 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,8 @@ - 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]) 0.7.5: - open 0.7.5 - Add a debug log message around import failures diff --git a/cloudinit/settings.py b/cloudinit/settings.py index 37d4958b..5efcb0b0 100644 --- a/cloudinit/settings.py +++ b/cloudinit/settings.py @@ -37,7 +37,7 @@ CFG_BUILTIN = { 'OVF', 'MAAS', 'GCE', - 'OpenStack' + 'OpenStack', 'Ec2', 'CloudSigma', 'CloudStack', -- cgit v1.2.3 From 589f740909b40d814a4b802263e61ff2b5c35b24 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 21 Aug 2014 16:26:43 -0400 Subject: fix rendering resolv.conf if no 'options' are provided this makes some changes to the cc_resolv_conf to make its generate_resolv_conf method more easily callable (for future test). Also sets it up so that 'options' is always defined when the template is rendered. LP: #1328953 --- ChangeLog | 1 + cloudinit/config/cc_resolv_conf.py | 29 ++++++++++++++++++----------- templates/resolv.conf.tmpl | 2 +- 3 files changed, 20 insertions(+), 12 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 4d8d6427..4d326b31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ 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) 0.7.5: - open 0.7.5 - Add a debug log message around import failures diff --git a/cloudinit/config/cc_resolv_conf.py b/cloudinit/config/cc_resolv_conf.py index 879b62b1..bbaa6c63 100644 --- a/cloudinit/config/cc_resolv_conf.py +++ b/cloudinit/config/cc_resolv_conf.py @@ -49,23 +49,22 @@ # +from cloudinit import log as logging from cloudinit.settings import PER_INSTANCE from cloudinit import templater from cloudinit import util +LOG = logging.getLogger(__name__) + frequency = PER_INSTANCE distros = ['fedora', 'rhel', 'sles'] -def generate_resolv_conf(cloud, log, params): - template_fn = cloud.get_template_filename('resolv.conf') - if not template_fn: - log.warn("No template found, not rendering /etc/resolv.conf") - return - +def generate_resolv_conf(template_fn, params, target_fname="/etc/resolv.conf"): flags = [] false_flags = [] + if 'options' in params: for key, val in params['options'].iteritems(): if type(val) == bool: @@ -77,12 +76,15 @@ def generate_resolv_conf(cloud, log, params): for flag in flags + false_flags: del params['options'][flag] + if not params.get('options'): + params['options'] = {} + params['flags'] = flags - log.debug("Writing resolv.conf from template %s" % template_fn) - templater.render_to_file(template_fn, '/etc/resolv.conf', params) + LOG.debug("Writing resolv.conf from template %s" % template_fn) + templater.render_to_file(template_fn, target_fname, params) -def handle(name, cfg, _cloud, log, _args): +def handle(name, cfg, cloud, log, _args): """ Handler for resolv.conf @@ -102,8 +104,13 @@ def handle(name, cfg, _cloud, log, _args): " 'manage_resolv_conf' present but set to False"), name) return - if not "resolv_conf" in cfg: + if "resolv_conf" not in cfg: log.warn("manage_resolv_conf True but no parameters provided!") - generate_resolv_conf(_cloud, log, cfg["resolv_conf"]) + template_fn = cloud.get_template_filename('resolv.conf') + if not template_fn: + log.warn("No template found, not rendering /etc/resolv.conf") + return + + generate_resolv_conf(template_fn=template_fn, params=cfg["resolv_conf"]) return diff --git a/templates/resolv.conf.tmpl b/templates/resolv.conf.tmpl index 6f908f30..1300156c 100644 --- a/templates/resolv.conf.tmpl +++ b/templates/resolv.conf.tmpl @@ -21,7 +21,7 @@ domain {{domain}} sortlist {% for sort in sortlist %}{{sort}} {% endfor %} {% endif %} -{% if options is defined or flags is defined %} +{% if options or flags %} options {% for flag in flags %}{{flag}} {% endfor %} {% for key, value in options.iteritems() -%} -- cgit v1.2.3 From bbe4b997819f43089aea12141ea393c1a46fe84d Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 22 Aug 2014 10:43:02 -0400 Subject: docs: fix disk-setup to reference 'table_type' LP: #1313114 --- ChangeLog | 1 + doc/examples/cloud-config-disk-setup.txt | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 4d326b31..b420d037 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ - 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) 0.7.5: - open 0.7.5 - Add a debug log message around import failures diff --git a/doc/examples/cloud-config-disk-setup.txt b/doc/examples/cloud-config-disk-setup.txt index 0dfef8e8..3e46a22e 100644 --- a/doc/examples/cloud-config-disk-setup.txt +++ b/doc/examples/cloud-config-disk-setup.txt @@ -7,7 +7,7 @@ disk_setup: ephmeral0: - type: 'mbr' + table_type: 'mbr' layout: True overwrite: False @@ -23,7 +23,7 @@ fs_setup: device_aliases: {'ephemeral0': '/dev/sdb'} disk_setup: ephemeral0: - type: mbr + table_type: mbr layout: True overwrite: False @@ -40,7 +40,7 @@ fs_setup: device_aliases: {'ephemeral0': '/dev/sdb'} disk_setup: ephemeral0: - type: mbr + table_type: mbr layout: False overwrite: False @@ -63,10 +63,10 @@ fs_setup: disk_setup: ephmeral0: - type: 'mbr' + table_type: 'mbr' layout: 'auto' /dev/xvdh: - type: 'mbr' + table_type: 'mbr' layout: - 33 - [33, 82] @@ -79,7 +79,7 @@ disk_setup: # The general format is: # disk_setup: # : -# type: 'mbr' +# table_type: 'mbr' # layout: # overwrite: # @@ -96,7 +96,7 @@ disk_setup: # Note: At this time, there is no handling or setup of # device mapper targets. # -# type=: Currently the following are supported: +# table_type=: Currently the following are supported: # 'mbr': default and setups a MS-DOS partition table # # Note: At this time only 'mbr' partition tables are allowed. @@ -116,7 +116,7 @@ disk_setup: # partition having a swap label, taking 1/3 of the disk space # and the remainder being used as the second partition. # /dev/xvdh': -# type: 'mbr' +# table_type: 'mbr' # layout: # - [33,82] # - 66 -- cgit v1.2.3 From 190cacc430900d9d2dd4dd45c59d01e30e469720 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 26 Aug 2014 12:25:50 -0400 Subject: ssh_authkey_fingerprints: fix bug that prevented disabling the module Module intended to allow disabling by configuration, but that was broken. Now this allows: no_ssh_fingerprints = True LP: #1340903 --- ChangeLog | 2 ++ cloudinit/config/cc_ssh_authkey_fingerprints.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index b420d037..97417cb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,8 @@ 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] 0.7.5: - open 0.7.5 - Add a debug log message around import failures diff --git a/cloudinit/config/cc_ssh_authkey_fingerprints.py b/cloudinit/config/cc_ssh_authkey_fingerprints.py index be8083db..7da62589 100644 --- a/cloudinit/config/cc_ssh_authkey_fingerprints.py +++ b/cloudinit/config/cc_ssh_authkey_fingerprints.py @@ -92,9 +92,10 @@ def _pprint_key_entries(user, key_fn, key_entries, hash_meth='md5', def handle(name, cfg, cloud, log, _args): - if 'no_ssh_fingerprints' in cfg: + if util.is_true(cfg.get('no_ssh_fingerprints', False)): log.debug(("Skipping module named %s, " "logging of ssh fingerprints disabled"), name) + return hash_meth = util.get_cfg_option_str(cfg, "authkey_hash", "md5") (users, _groups) = ds.normalize_users_groups(cfg, cloud.distro) -- cgit v1.2.3 From e17823ebeb397110c2163629d9f0f94dbea0c5e4 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 8 Sep 2014 12:50:22 -0400 Subject: resizefs: first check if device is writable before attempting In a container the device nodes may exist but not be writable. I'm seeing this on trusty host with trusty containers, the root device ends up looking like it is to /dev/loop0. LP: #1366891 --- ChangeLog | 1 + cloudinit/config/cc_resizefs.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index dbd0715a..01ecb53c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,7 @@ - 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. 0.7.5: - open 0.7.5 - Add a debug log message around import failures diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py index b9655749..7e796228 100644 --- a/cloudinit/config/cc_resizefs.py +++ b/cloudinit/config/cc_resizefs.py @@ -98,12 +98,12 @@ def handle(name, cfg, _cloud, log, args): (devpth, fs_type, mount_point) = result - # Ensure the path is a block device. info = "dev=%s mnt_point=%s path=%s" % (devpth, mount_point, resize_what) log.debug("resize_info: %s" % info) container = util.is_container() + # Ensure the path is a block device. if (devpth == "/dev/root" and not os.path.exists(devpth) and not container): devpth = rootdev_from_cmdline(util.get_cmdline()) @@ -117,14 +117,22 @@ def handle(name, cfg, _cloud, log, args): except OSError as exc: if container and exc.errno == errno.ENOENT: log.debug("Device '%s' did not exist in container. " - "cannot resize: %s" % (devpth, info)) + "cannot resize: %s", devpth, info) elif exc.errno == errno.ENOENT: - log.warn("Device '%s' did not exist. cannot resize: %s" % - (devpth, info)) + log.warn("Device '%s' did not exist. cannot resize: %s", + devpth, info) else: raise exc return + if not os.access(devpth, os.W_OK): + if container: + log.debug("'%s' not writable in container. cannot resize: %s", + devpth, info) + else: + log.warn("'%s' not writable. cannot resize: %s", devpth, info) + return + if not stat.S_ISBLK(statret.st_mode) and not stat.S_ISCHR(statret.st_mode): if container: log.debug("device '%s' not a block device in container." -- cgit v1.2.3