juju-deployer handles empty config files ungracefully

Bug #1666600 reported by Chris Stratford
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-deployer
Confirmed
Low
Unassigned

Bug Description

If you run juju-deployer with an empty config file (e.g. "juju-deployer -c myconfig.cfg -c secrets.cfg" where secrets.cfg is zero bytes) it dies with a stacktrace:

Traceback (most recent call last):
  File "/usr/bin/juju-deployer", line 9, in <module>
    load_entry_point('juju-deployer==0.9.2', 'console_scripts', 'juju-deployer')()
  File "/usr/lib/python3/dist-packages/deployer/cli.py", line 140, in main
    run()
  File "/usr/lib/python3/dist-packages/deployer/cli.py", line 182, in run
    config = ConfigStack(options.configs or [], options.series)
  File "/usr/lib/python3/dist-packages/deployer/config.py", line 34, in __init__
    self.load()
  File "/usr/lib/python3/dist-packages/deployer/config.py", line 92, in load
    for fp in self._resolve_included():
  File "/usr/lib/python3/dist-packages/deployer/config.py", line 141, in _resolve_included
    [files.extend(self._includes(cf)) for cf in self.config_files]
  File "/usr/lib/python3/dist-packages/deployer/config.py", line 141, in <listcomp>
    [files.extend(self._includes(cf)) for cf in self.config_files]
  File "/usr/lib/python3/dist-packages/deployer/config.py", line 123, in _includes
    d = self._yaml_load(config_file)
  File "/usr/lib/python3/dist-packages/deployer/config.py", line 61, in _yaml_load
    services = yaml_result.get('services')
AttributeError: 'NoneType' object has no attribute 'get'

It really should just skip the empty file (or if it really has to, report an error), not just die.

Revision history for this message
Tom Haddon (mthaddon) wrote :

I'm not sure we'd want it to skip the empty file would we? I agree the stacktrace is a bit unfriendly, but I think it should error out telling you you're trying to pass it an empty file (which presumably you didn't want to do).

Tom Haddon (mthaddon)
Changed in juju-deployer:
status: New → Confirmed
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.