From b9314a18a052e934643c93b81dc938b3e5b69307 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 9 Jan 2014 13:12:40 -0500 Subject: Azure: minor changes for filename as strings and logging. We were passing a unicode string to 'runcmd' in the path to the .crt file. That is because the keyname was coming from ovf file as unicode. Ie: u'/var/lib/waagent/6BE7A7C3C8A8F4B123CCA5D0C2F1BE4CA7B63ED7.crt' Then, logging was extending not appending errors. --- ChangeLog | 2 ++ cloudinit/sources/DataSourceAzure.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1286e7c1..8029f9af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ apt_get_wrapper (LP: #1236531). - convert paths provided in config-drive 'files' to string before writing (LP: #1260072). + - Azure: minor changes in logging output. ensure filenames are strings (not + unicode). 0.7.4: - fix issue mounting 'ephemeral0' if ephemeral0 was an alias for a partitioned block device with target filesystem on ephemeral0.1. diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index b18c57e7..97f151d6 100644 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -154,7 +154,7 @@ class DataSourceAzureNet(sources.DataSource): fp_files = [] for pk in self.cfg.get('_pubkeys', []): - bname = pk['fingerprint'] + ".crt" + bname = str(pk['fingerprint'] + ".crt") fp_files += [os.path.join(mycfg['data_dir'], bname)] missing = util.log_time(logfunc=LOG.debug, msg="waiting for files", @@ -247,7 +247,7 @@ def pubkeys_from_crt_files(flist): try: pubkeys.append(crtfile_to_pubkey(fname)) except util.ProcessExecutionError: - errors.extend(fname) + errors.append(fname) if errors: LOG.warn("failed to convert the crt files to pubkey: %s" % errors) -- cgit v1.2.3 From 08b50a6ea239f480493f202c563d788cabb92380 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 14 Jan 2014 13:18:14 -0500 Subject: provide default 'output' setting to log to /var/log/cloud-init-output.log This has been "best practice" for quite some time, and its a common request of "where is the output of my user-data programs". http://askubuntu.com/questions/345344/where-are-the-logs-for-my-user-data-script-cloud-init --- ChangeLog | 2 ++ config/cloud.cfg.d/05_logging.cfg | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8029f9af..1c240c68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ (LP: #1260072). - Azure: minor changes in logging output. ensure filenames are strings (not unicode). + - config/cloud.cfg.d/05_logging.cfg: provide a default 'output' setting, to + redirect cloud-init stderr and stdout /var/log/cloud-init-output.log. 0.7.4: - fix issue mounting 'ephemeral0' if ephemeral0 was an alias for a partitioned block device with target filesystem on ephemeral0.1. diff --git a/config/cloud.cfg.d/05_logging.cfg b/config/cloud.cfg.d/05_logging.cfg index 410a0650..2e180730 100644 --- a/config/cloud.cfg.d/05_logging.cfg +++ b/config/cloud.cfg.d/05_logging.cfg @@ -59,3 +59,8 @@ log_cfgs: - [ *log_base, *log_file ] # A file path can also be used # - /etc/log.conf + +# this tells cloud-init to redirect its stdout and stderr to +# 'tee -a /var/log/cloud-init-output.log' so the user can see output +# there without needing to look on the console. +output: {all: '| tee -a /var/log/cloud-init-output.log'} -- cgit v1.2.3