def _ensure_inventory_uptodate(inventory, container_skel):
 host_vars = inventory['_meta']['hostvars']
 for (hostname, _vars) in host_vars.items():
  if ('container_name' not in _vars):
   _vars['container_name'] = hostname
  for rh in REQUIRED_HOSTVARS:
   if (rh not in _vars):
    _vars[rh] = None
    if (rh == 'container_networks'):
     _vars[rh] = {}
 for (container_type, type_vars) in container_skel.items():
  item = inventory.get(container_type)
  hosts = item.get('hosts')
  if hosts:
   for host in hosts:
    container = host_vars[host]
    if ('properties' in type_vars):
     logger.debug('Copied propeties for %s from skeleton', container)
     container['properties'] = type_vars['properties']

def _ensure_inventory_uptodate ( inventory , container_skel ) : host_vars = inventory [ '_meta' ] [ 'hostvars' ] for ( hostname , _vars ) in host_vars . items ( ) : if ( 'container_name' not in _vars ) : _vars [ 'container_name' ] = hostname for rh in REQUIRED_HOSTVARS : if ( rh not in _vars ) : _vars [ rh ] = None if ( rh == 'container_networks' ) : _vars [ rh ] = { } for ( container_type , type_vars ) in container_skel . items ( ) : item = inventory . get ( container_type ) hosts = item . get ( 'hosts' ) if hosts : for host in hosts : container = host_vars [ host ] if ( 'properties' in type_vars ) : logger . debug ( 'Copied propeties for %s from skeleton' , container ) container [ 'properties' ] = type_vars [ 'properties' ]
update inventory if needed .