summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-03-04 12:42:34 -0500
committerScott Moser <smoser@ubuntu.com>2015-03-04 12:42:34 -0500
commitac445690ab7a69ac6e9c74b136de9968b0c839df (patch)
tree5bd39529003de1bc45304bc9e510ecd4ec713c32 /cloudinit
parentdf975abae42664bbd5fd56436eb2947e2a6f46f9 (diff)
downloadvyos-cloud-init-ac445690ab7a69ac6e9c74b136de9968b0c839df.tar.gz
vyos-cloud-init-ac445690ab7a69ac6e9c74b136de9968b0c839df.zip
fix logging perms with list rather than single
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/settings.py2
-rw-r--r--cloudinit/stages.py21
2 files changed, 16 insertions, 7 deletions
diff --git a/cloudinit/settings.py b/cloudinit/settings.py
index 5efcb0b0..b61e5613 100644
--- a/cloudinit/settings.py
+++ b/cloudinit/settings.py
@@ -47,7 +47,7 @@ CFG_BUILTIN = {
],
'def_log_file': '/var/log/cloud-init.log',
'log_cfgs': [],
- 'syslog_fix_perms': 'syslog:adm',
+ 'syslog_fix_perms': ['syslog:adm', 'root:adm'],
'system_info': {
'paths': {
'cloud_dir': '/var/lib/cloud',
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index 45d64823..d28e765b 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -148,16 +148,25 @@ class Init(object):
def _initialize_filesystem(self):
util.ensure_dirs(self._initial_subdirs())
log_file = util.get_cfg_option_str(self.cfg, 'def_log_file')
- perms = util.get_cfg_option_str(self.cfg, 'syslog_fix_perms')
if log_file:
util.ensure_file(log_file)
- if perms:
- u, g = util.extract_usergroup(perms)
+ perms = self.cfg.get('syslog_fix_perms')
+ if not perms:
+ perms = {}
+ if not isinstance(perms, list):
+ perms = [perms]
+
+ error = None
+ for perm in perms:
+ u, g = util.extract_usergroup(perm)
try:
util.chownbyname(log_file, u, g)
- except OSError:
- util.logexc(LOG, "Unable to change the ownership of %s to "
- "user %s, group %s", log_file, u, g)
+ return
+ except OSError as e:
+ error = e
+
+ LOG.warn("Failed changing perms on '%s'. tried: %s. %s",
+ log_file, ','.join(perms), error)
def read_cfg(self, extra_fns=None):
# None check so that we don't keep on re-loading if empty