From 91ccf1b55b5b79694449446b029dd7c4570517a5 Mon Sep 17 00:00:00 2001 From: Chris Cosby Date: Wed, 3 Dec 2014 01:13:52 -0500 Subject: Handle more possible ssh_pwauth values Update ssh_pwauth handler to accept all values mentioned in doc/examples/cloud-config.txt --- cloudinit/config/cc_set_passwords.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py index 4ca85e21..fcfd3d1b 100644 --- a/cloudinit/config/cc_set_passwords.py +++ b/cloudinit/config/cc_set_passwords.py @@ -45,8 +45,6 @@ def handle(_name, cfg, cloud, log, args): password = util.get_cfg_option_str(cfg, "password", None) expire = True - pw_auth = "no" - change_pwauth = False plist = None if 'chpasswd' in cfg: @@ -104,11 +102,24 @@ def handle(_name, cfg, cloud, log, args): change_pwauth = False pw_auth = None if 'ssh_pwauth' in cfg: - change_pwauth = True if util.is_true(cfg['ssh_pwauth']): + change_pwauth = True pw_auth = 'yes' - if util.is_false(cfg['ssh_pwauth']): + elif util.is_false(cfg['ssh_pwauth']): + change_pwauth = True pw_auth = 'no' + elif str(cfg['ssh_pwauth']).lower() == 'unchanged': + log.debug('Leaving auth line unchanged') + change_pwauth = False + elif not str(cfg['ssh_pwauth']).strip(): + log.debug('Leaving auth line unchanged') + change_pwauth = False + elif not cfg['ssh_pwauth']: + log.debug('Leaving auth line unchanged') + change_pwauth = False + else: + util.logexc(log, 'Unrecognized value %r for ssh_pwauth' % cfg['ssh_pwauth']) + if change_pwauth: replaced_auth = False -- cgit v1.2.3 From 2fa4b17b7799a4cf047aaadae4e52823c94995ff Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sat, 14 Nov 2015 22:14:40 -0600 Subject: replaced old logos with new logos --- doc/rtd/static/logo.png | Bin 16031 -> 18118 bytes doc/rtd/static/logo.svg | 14445 +--------------------------------------------- 2 files changed, 89 insertions(+), 14356 deletions(-) diff --git a/doc/rtd/static/logo.png b/doc/rtd/static/logo.png index 893b7e3b..73bf4aef 100644 Binary files a/doc/rtd/static/logo.png and b/doc/rtd/static/logo.png differ diff --git a/doc/rtd/static/logo.svg b/doc/rtd/static/logo.svg index b22ce2a0..7a2ae21b 100644 --- a/doc/rtd/static/logo.svg +++ b/doc/rtd/static/logo.svg @@ -1,14356 +1,89 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - Layer 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CloudInit - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From c317be91b3cb7324318e49fa8946b5bb6d8b52d6 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sat, 14 Nov 2015 22:22:44 -0600 Subject: resize to match the rtd width --- doc/rtd/static/logo.png | Bin 18118 -> 12751 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/doc/rtd/static/logo.png b/doc/rtd/static/logo.png index 73bf4aef..e980fdea 100644 Binary files a/doc/rtd/static/logo.png and b/doc/rtd/static/logo.png differ -- cgit v1.2.3 From df9719a785a31ca7cf21ae398e2eeac35496000b Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sat, 14 Nov 2015 22:32:04 -0600 Subject: use the Ubuntu font, when possible, in the documentation --- doc/rtd/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/rtd/conf.py b/doc/rtd/conf.py index d3764bea..8a391f21 100644 --- a/doc/rtd/conf.py +++ b/doc/rtd/conf.py @@ -68,8 +68,8 @@ html_theme = 'default' # further. For a list of options available for each theme, see the # documentation. html_theme_options = { - "bodyfont": "Arial, sans-serif", - "headfont": "Arial, sans-serif" + "bodyfont": "Ubuntu, Arial, sans-serif", + "headfont": "Ubuntu, Arial, sans-serif" } # The name of an image file (relative to this directory) to place at the top -- cgit v1.2.3 From 22c7762b0c4a6abc96bdb7fd494599af343eb622 Mon Sep 17 00:00:00 2001 From: Peter Hurley Date: Thu, 17 Dec 2015 10:57:55 -0800 Subject: doc/sources/nocloud: document the volume label requirement document that vfat and iso9660 filesystems must have 'cidata' volume label to be recognized as a potential NoCloud data source. --- doc/sources/nocloud/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/sources/nocloud/README.rst b/doc/sources/nocloud/README.rst index aa3cf1a3..08a39377 100644 --- a/doc/sources/nocloud/README.rst +++ b/doc/sources/nocloud/README.rst @@ -3,7 +3,7 @@ and meta-data to the instance without running a network service (or even without having a network at all). You can provide meta-data and user-data to a local vm boot via files on a `vfat`_ -or `iso9660`_ filesystem. +or `iso9660`_ filesystem. The filesystem volume label must be ``cidata``. These user-data and meta-data files are expected to be in the following format. -- cgit v1.2.3 From 2eb86ca13cb658b51440bb28cab47205b641d0ee Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 10 Mar 2016 10:32:08 -0500 Subject: initial systemd service suggestions provided by pitti This should mean that cloud-init-local is running earlier now (DefaultDependencies=no). And also blocking networking coming up (Before=network-pre.target) cloud-init.service should now actually block network-online.target from being made (meaning it will run before anything that expects that) but after networking.service, which is what actually does the bringup on ifupdown / ubuntu. --- systemd/cloud-init-local.service | 4 ++++ systemd/cloud-init.service | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/systemd/cloud-init-local.service b/systemd/cloud-init-local.service index 73aa46f6..475a2e11 100644 --- a/systemd/cloud-init-local.service +++ b/systemd/cloud-init-local.service @@ -1,7 +1,11 @@ [Unit] Description=Initial cloud-init job (pre-networking) +DefaultDependencies=no Wants=local-fs.target After=local-fs.target +Conflicts=shutdown.target +Before=network-pre.target +Before=shutdown.target [Service] Type=oneshot diff --git a/systemd/cloud-init.service b/systemd/cloud-init.service index 1f656f7f..6fb655e6 100644 --- a/systemd/cloud-init.service +++ b/systemd/cloud-init.service @@ -1,8 +1,8 @@ [Unit] Description=Initial cloud-init job (metadata service crawler) -After=local-fs.target network-online.target cloud-init-local.service -Before=sshd.service sshd-keygen.service systemd-user-sessions.service -Requires=network-online.target +After=cloud-init-local.service networking.service +Before=network-online.target sshd.service sshd-keygen.service systemd-user-sessions.service +Requires=networking.service Wants=local-fs.target cloud-init-local.service sshd.service sshd-keygen.service [Service] -- cgit v1.2.3 From 2f29e70d99906dd7bff0c64109a77f609577f063 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 10 Mar 2016 10:35:17 -0500 Subject: generator: support reading cmdline of pid 1 in a container This might need cleaning up in the future as I believe in some containers /proc/cmdline is provided, and in that case it would be preferred to pid 1's command line. --- systemd/cloud-init-generator | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/systemd/cloud-init-generator b/systemd/cloud-init-generator index 9d1e22f0..b7a2f17a 100755 --- a/systemd/cloud-init-generator +++ b/systemd/cloud-init-generator @@ -32,15 +32,16 @@ etc_file() { } read_proc_cmdline() { - if [ "$CONTAINER" = "lxc" ]; then - _RET_MSG="ignored: \$container=$CONTAINER" - _RET="" - return 0 - fi - - if systemd-detect-virt --container --quiet; then - _RET_MSG="ignored: detect-virt is container" + # return /proc/cmdline for non-container, and /proc/1/cmdline for container + local ctname="systemd" + if [ -n "$CONTAINER" ] && ctname=$CONTAINER || systemd-detect-virt --container --quiet; then + local + if _RET=$(tr '\0' ' ' < /proc/1/cmdline) >/dev/null 2>&1; then + _RET_MSG="container[$ctname]: pid 1 cmdline" + return + fi _RET="" + _RET_MSG="container[$ctname]: pid 1 cmdline not available" return 0 fi -- cgit v1.2.3 From b1d9c92f5bc6f711e104ceb981ded658249c3255 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 10 Mar 2016 10:41:48 -0500 Subject: generator: use /run/cloud-init instead of /run --- systemd/cloud-init-generator | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/systemd/cloud-init-generator b/systemd/cloud-init-generator index b7a2f17a..8156db58 100755 --- a/systemd/cloud-init-generator +++ b/systemd/cloud-init-generator @@ -3,7 +3,7 @@ set -f LOG="" DEBUG_LEVEL=1 -LOG_D="/run" +LOG_D="/run/cloud-init" ENABLE="enabled" DISABLE="disabled" CLOUD_SYSTEM_TARGET="/lib/systemd/system/cloud-init.target" @@ -17,7 +17,8 @@ debug() { [ "$lvl" -gt "$DEBUG_LEVEL" ] && return if [ -z "$LOG" ]; then local log="$LOG_D/${0##*/}.log" - { : > "$log"; } >/dev/null 2>&1 && LOG="$log" || + { [ -d "$LOG_D" ] || mkdir -p "$LOG_D"; } && + { : > "$log"; } >/dev/null 2>&1 && LOG="$log" || LOG="/dev/kmsg" fi echo "$@" >> "$LOG" -- cgit v1.2.3 From 03f80fa62eb85270a7a96850c5e689a1c4bc0049 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 14 Mar 2016 09:21:02 -0400 Subject: change return value for dmi data of all \xff to be "" Previously we returned a string of "." the same length as the dmi field. That seems confusing to the user as "." would seem like a valid response when in fact this value should not be considered valid. So now, in this case, return empty string. --- cloudinit/util.py | 7 +++++-- tests/unittests/test_util.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cloudinit/util.py b/cloudinit/util.py index 1a517c79..caae17ce 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -2148,7 +2148,7 @@ def _read_dmi_syspath(key): # uninitialized dmi values show as all \xff and /sys appends a '\n'. # in that event, return a string of '.' in the same length. if key_data == b'\xff' * (len(key_data) - 1) + b'\n': - key_data = b'.' * (len(key_data) - 1) + b'\n' + key_data = b"" str_data = key_data.decode('utf8').strip() LOG.debug("dmi data %s returned %s", dmi_key_path, str_data) @@ -2193,7 +2193,10 @@ def read_dmi_data(key): dmidecode_path = which('dmidecode') if dmidecode_path: - return _call_dmidecode(key, dmidecode_path) + ret = _call_dmidecode(key, dmidecode_path) + if ret is not None and ret.replace(".", "") == "": + return "" + return ret LOG.warn("did not find either path %s or dmidecode command", DMI_SYS_PATH) diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index 542e4075..bdee9719 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -388,7 +388,7 @@ class TestReadDMIData(helpers.FilesystemMockingTestCase): def test_dots_returned_instead_of_foxfox(self): my_len = 32 dmi_value = b'\xff' * my_len + b'\n' - expected = '.' * my_len + expected = "" dmi_key = 'system-product-name' sysfs_key = 'product_name' self._create_sysfs_file(sysfs_key, dmi_value) -- cgit v1.2.3 From f8fe3182ac5e6b7b3b4a81e034e87bfd1327f82b Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 14 Mar 2016 09:25:50 -0400 Subject: change where we handle the translation --- cloudinit/util.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cloudinit/util.py b/cloudinit/util.py index caae17ce..f84f120e 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -2168,6 +2168,8 @@ def _call_dmidecode(key, dmidecode_path): cmd = [dmidecode_path, "--string", key] (result, _err) = subp(cmd) LOG.debug("dmidecode returned '%s' for '%s'", result, key) + if result.replace(".", "") == "": + return "" return result except (IOError, OSError) as _err: LOG.debug('failed dmidecode cmd: %s\n%s', cmd, _err.message) @@ -2193,10 +2195,7 @@ def read_dmi_data(key): dmidecode_path = which('dmidecode') if dmidecode_path: - ret = _call_dmidecode(key, dmidecode_path) - if ret is not None and ret.replace(".", "") == "": - return "" - return ret + return _call_dmidecode(key, dmidecode_path) LOG.warn("did not find either path %s or dmidecode command", DMI_SYS_PATH) -- cgit v1.2.3 From 001057f01e698c3ca0c078d9535f05fdebec2d80 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 14 Mar 2016 09:34:46 -0400 Subject: strip return of dmidecode and do so before checking for all "." --- cloudinit/util.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cloudinit/util.py b/cloudinit/util.py index f84f120e..f9e37a79 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -2168,6 +2168,7 @@ def _call_dmidecode(key, dmidecode_path): cmd = [dmidecode_path, "--string", key] (result, _err) = subp(cmd) LOG.debug("dmidecode returned '%s' for '%s'", result, key) + result = result.strip() if result.replace(".", "") == "": return "" return result -- cgit v1.2.3 From c3ece3129228ad7f2206d049af0f4635da8e8eb5 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 14 Mar 2016 14:24:27 -0400 Subject: fix long line --- cloudinit/config/cc_set_passwords.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py index ff3b9ba5..58e1b713 100644 --- a/cloudinit/config/cc_set_passwords.py +++ b/cloudinit/config/cc_set_passwords.py @@ -118,8 +118,8 @@ def handle(_name, cfg, cloud, log, args): log.debug('Leaving auth line unchanged') change_pwauth = False else: - util.logexc(log, 'Unrecognized value %r for ssh_pwauth' % cfg['ssh_pwauth']) - + msg = 'Unrecognized value %s for ssh_pwauth' % cfg['ssh_pwauth'] + util.logexc(log, msg) if change_pwauth: replaced_auth = False -- cgit v1.2.3