def migrate_hosted_facts(facts):
 if ('master' in facts):
  if ('router_selector' in facts['master']):
   if ('hosted' not in facts):
    facts['hosted'] = {}
   if ('router' not in facts['hosted']):
    facts['hosted']['router'] = {}
   facts['hosted']['router']['selector'] = facts['master'].pop('router_selector')
  if ('registry_selector' in facts['master']):
   if ('hosted' not in facts):
    facts['hosted'] = {}
   if ('registry' not in facts['hosted']):
    facts['hosted']['registry'] = {}
   facts['hosted']['registry']['selector'] = facts['master'].pop('registry_selector')
 return facts

def migrate_hosted_facts ( facts ) : if ( 'master' in facts ) : if ( 'router_selector' in facts [ 'master' ] ) : if ( 'hosted' not in facts ) : facts [ 'hosted' ] = { } if ( 'router' not in facts [ 'hosted' ] ) : facts [ 'hosted' ] [ 'router' ] = { } facts [ 'hosted' ] [ 'router' ] [ 'selector' ] = facts [ 'master' ] . pop ( 'router_selector' ) if ( 'registry_selector' in facts [ 'master' ] ) : if ( 'hosted' not in facts ) : facts [ 'hosted' ] = { } if ( 'registry' not in facts [ 'hosted' ] ) : facts [ 'hosted' ] [ 'registry' ] = { } facts [ 'hosted' ] [ 'registry' ] [ 'selector' ] = facts [ 'master' ] . pop ( 'registry_selector' ) return facts
apply migrations for master facts .