def migrate_common_facts(facts):
 params = {'node': 'portal_net', 'master': 'portal_net'}
 if ('common' not in facts):
  facts['common'] = {}
 for role in params.keys():
  if (role in facts):
   for param in params[role]:
    if (param in facts[role]):
     facts['common'][param] = facts[role].pop(param)
 return facts

def migrate_common_facts ( facts ) : params = { 'node' : 'portal_net' , 'master' : 'portal_net' } if ( 'common' not in facts ) : facts [ 'common' ] = { } for role in params . keys ( ) : if ( role in facts ) : for param in params [ role ] : if ( param in facts [ role ] ) : facts [ 'common' ] [ param ] = facts [ role ] . pop ( param ) return facts
migrate facts from various roles into common .