Set container_networks to a dict rather than None

Ensure container_networks is an empty dict rather than None. This
ensures that if there are no container_networks on a host the
dynamic_inventory won't crash. container_networks is a required host
variable, setting it to an empty dict allows it to be ignored when
looping through if there are no container_networks.

Change-Id: Id0517ac6e06e704cf71964c03f016989db51fde5
Closes-Bug: #1430430
This commit is contained in:
Andy McCrae
2015-03-12 10:31:10 +00:00
parent 49cfbb20aa
commit c3270f1bde

View File

@@ -766,6 +766,8 @@ def _ensure_inventory_uptodate(inventory, container_skel):
for rh in REQUIRED_HOSTVARS:
if rh not in value:
value[rh] = None
if rh == 'container_networks':
value[rh] = {}
for key, value in container_skel.iteritems():
item = inventory.get(key)