FS#53036 - [cloud-init] Default 05_logging.cfg not viable

Attached to Project: Community Packages
Opened by Dan Peschman (dpeschman) - Tuesday, 21 February 2017, 00:37 GMT
Last edited by Balló György (City-busz) - Sunday, 07 January 2018, 21:50 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

05_logging.cfg as provided causes exception when running the program (below).

Additional info:
* cloud-init-0.7.9-1

[root@arch dan]# cat /etc/cloud/cloud.cfg.d/05_logging.cfg
## This yaml formated config file handles setting
## logger information. The values that are necessary to be set
## are seen at the bottom. The top '_log' are only used to remove
## redundency in a syslog and fallback-to-file case.
##
## The 'log_cfgs' entry defines a list of logger configs
## Each entry in the list is tried, and the first one that
## works is used. If a log_cfg list entry is an array, it will
## be joined with '\n'.
_log:
- &log_base |
[loggers]
keys=root,cloudinit

[handlers]
keys=consoleHandler,cloudLogHandler

[formatters]
keys=simpleFormatter,arg0Formatter

[logger_root]
level=DEBUG
handlers=consoleHandler,cloudLogHandler

[logger_cloudinit]
level=DEBUG
qualname=cloudinit
handlers=
propagate=1

[handler_consoleHandler]
class=StreamHandler
level=WARNING
formatter=arg0Formatter
args=(sys.stderr,)

[formatter_arg0Formatter]
format=%(asctime)s - %(filename)s[%(levelname)s]: %(message)s

[formatter_simpleFormatter]
format=%(levelname)s %(filename)s: %(message)s

- &log_syslog |
[handler_cloudLogHandler]
class=handlers.SysLogHandler
level=INFO
formatter=simpleFormatter
args=("/dev/log", handlers.SysLogHandler.LOG_DAEMON)

log_cfgs:
# Array entries in this list will be joined into a string
# that defines the configuration.
#
# If you want logs to go to syslog, uncomment the following line.
# - [ *log_base, *log_syslog ]
#
# The default behavior is to just log to a file.
# This mechanism that does not depend on a system service to operate.
# - [ *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'}


Steps to reproduce:
[root@arch dan]# pacman -Sy cloud-init
...
Packages (1) cloud-init-0.7.9-1
:: Proceed with installation? [Y/n] Y
...
:: Processing package changes...
(1/1) installing cloud-init [##########################################################################] 100%

[root@arch dan]# cloud-init init
failed run of stage init
------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 513, in status_wrapper
ret = functor(name, args)
File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 185, in main_init
logging.setupLogging(init.cfg)
File "/usr/lib/python2.7/site-packages/cloudinit/log.py", line 69, in setupLogging
for a_cfg in cfg['log_cfgs']:
TypeError: 'NoneType' object is not iterable
------------------------------------------------------------
This task depends upon

Closed by  Balló György (City-busz)
Sunday, 07 January 2018, 21:50 GMT
Reason for closing:  Won't fix
Comment by Dan Peschman (dpeschman) - Tuesday, 21 February 2017, 00:46 GMT
I fixed this by replacing
# - [ *log_base, *log_file ]
with
- [ *log_base ]
in 05_logging.cfg. This results in logs written to standard out and /var/log/clout-init-output.log.
Comment by Balló György (City-busz) - Sunday, 07 January 2018, 21:50 GMT

Loading...