1
------------------------------------------------------------
3
committer: Scott Moser <smoser@ubuntu.com>
5
timestamp: Thu 2011-01-27 10:27:54 -0500
7
take correct action if def_log_file and syslog_fix_perms are empty
8
=== modified file 'cloudinit/__init__.py'
9
--- old/cloudinit/__init__.py 2011-01-27 14:30:37 +0000
10
+++ new/cloudinit/__init__.py 2011-01-27 15:27:54 +0000
12
util.ensure_dirs(dlist)
14
cfg = util.get_base_cfg(system_config,cfg_builtin,parsed_cfgs)
16
- if 'def_log_file' in cfg:
17
- log_file = cfg['def_log_file']
18
+ log_file = util.get_cfg_option_str(cfg, 'def_log_file', None)
19
+ perms = util.get_cfg_option_str(cfg, 'syslog_fix_perms', None)
21
fp = open(log_file,"ab")
23
- if log_file and 'syslog_fix_perms' in cfg:
24
- perms = cfg['syslog_fix_perms']
25
+ if log_file and perms:
26
(u,g) = perms.split(':',1)
27
if u == "-1" or u == "None": u = None
28
if g == "-1" or g == "None": g = None
30
=== modified file 'doc/examples/cloud-config.txt'
31
--- old/doc/examples/cloud-config.txt 2011-01-26 22:09:52 +0000
32
+++ new/doc/examples/cloud-config.txt 2011-01-27 15:27:54 +0000
34
# timezone: set the timezone for this instance
35
# the value of 'timezone' must exist in /usr/share/zoneinfo
38
+# def_log_file and syslog_fix_perms work together
40
+# - logging is set to go to a log file 'L' both with and without syslog
41
+# - and 'L' does not exist
42
+# - and syslog is configured to write to 'L'
43
+# then 'L' will be initially created with root:root ownership (during
44
+# cloud-init), and then at cloud-config time (when syslog is available)
45
+# the syslog daemon will be unable to write to the file.
47
+# to remedy this situation, 'def_log_file' can be set to a filename
48
+# and syslog_fix_perms to a string containing "<user>:<group>"
50
+# the default values are '/var/log/cloud-init.log' and 'syslog:adm'
51
+# the value of 'def_log_file' should match what is configured in logging
52
+# if either is empty, then no change of ownership will be done
53
+def_log_file: /var/log/my-logging-file.log
54
+syslog_fix_perms: syslog:root