tobami / littlechef

Cook with Chef without a Chef Server
Apache License 2.0
473 stars 70 forks source link

don't fail with KeyError 'guests' if now guests are defined for a host #226

Closed thekorn closed 9 years ago

thekorn commented 9 years ago
Traceback (most recent call last):
  File "/home/markus/devel/.virtualenvs/devops/local/lib/python2.7/site-packages/fabric/main.py", line 743, in main
    *args, **kwargs
  File "/home/markus/devel/.virtualenvs/devops/local/lib/python2.7/site-packages/fabric/tasks.py", line 409, in execute
    results['<local-only>'] = task.run(*args, **new_kwargs)
  File "/home/markus/devel/.virtualenvs/devops/local/lib/python2.7/site-packages/fabric/tasks.py", line 174, in run
    return self.wrapped(*args, **kwargs)
  File "/home/markus/devel/.virtualenvs/devops/local/lib/python2.7/site-packages/littlechef/runner.py", line 115, in nodes_with_tag
    nodes = [n['name'] for n in nodes]
  File "/home/markus/devel/.virtualenvs/devops/local/lib/python2.7/site-packages/littlechef/lib.py", line 166, in get_nodes_with_tag
    for guest in n['virtualization']['guests']:
KeyError: 'guests'

line [0] needs a .get('guests', [])

[0] https://github.com/tobami/littlechef/blob/master/littlechef/lib.py#L166

tobami commented 9 years ago

Closed by #227