def set_selectors(facts):
 deployment_type = facts['common']['deployment_type']
 if (deployment_type == 'online'):
  selector = 'type=infra'
 else:
  selector = 'region=infra'
 if ('hosted' not in facts):
  facts['hosted'] = {}
 if ('router' not in facts['hosted']):
  facts['hosted']['router'] = {}
 if (('selector' not in facts['hosted']['router']) or (facts['hosted']['router']['selector'] in [None, 'None'])):
  facts['hosted']['router']['selector'] = selector
 if ('registry' not in facts['hosted']):
  facts['hosted']['registry'] = {}
 if (('selector' not in facts['hosted']['registry']) or (facts['hosted']['registry']['selector'] in [None, 'None'])):
  facts['hosted']['registry']['selector'] = selector
 if ('metrics' not in facts['hosted']):
  facts['hosted']['metrics'] = {}
 if (('selector' not in facts['hosted']['metrics']) or (facts['hosted']['metrics']['selector'] in [None, 'None'])):
  facts['hosted']['metrics']['selector'] = None
 if ('logging' not in facts['hosted']):
  facts['hosted']['logging'] = {}
 if (('selector' not in facts['hosted']['logging']) or (facts['hosted']['logging']['selector'] in [None, 'None'])):
  facts['hosted']['logging']['selector'] = None
 return facts

def set_selectors ( facts ) : deployment_type = facts [ 'common' ] [ 'deployment_type' ] if ( deployment_type == 'online' ) : selector = 'type=infra' else : selector = 'region=infra' if ( 'hosted' not in facts ) : facts [ 'hosted' ] = { } if ( 'router' not in facts [ 'hosted' ] ) : facts [ 'hosted' ] [ 'router' ] = { } if ( ( 'selector' not in facts [ 'hosted' ] [ 'router' ] ) or ( facts [ 'hosted' ] [ 'router' ] [ 'selector' ] in [ None , 'None' ] ) ) : facts [ 'hosted' ] [ 'router' ] [ 'selector' ] = selector if ( 'registry' not in facts [ 'hosted' ] ) : facts [ 'hosted' ] [ 'registry' ] = { } if ( ( 'selector' not in facts [ 'hosted' ] [ 'registry' ] ) or ( facts [ 'hosted' ] [ 'registry' ] [ 'selector' ] in [ None , 'None' ] ) ) : facts [ 'hosted' ] [ 'registry' ] [ 'selector' ] = selector if ( 'metrics' not in facts [ 'hosted' ] ) : facts [ 'hosted' ] [ 'metrics' ] = { } if ( ( 'selector' not in facts [ 'hosted' ] [ 'metrics' ] ) or ( facts [ 'hosted' ] [ 'metrics' ] [ 'selector' ] in [ None , 'None' ] ) ) : facts [ 'hosted' ] [ 'metrics' ] [ 'selector' ] = None if ( 'logging' not in facts [ 'hosted' ] ) : facts [ 'hosted' ] [ 'logging' ] = { } if ( ( 'selector' not in facts [ 'hosted' ] [ 'logging' ] ) or ( facts [ 'hosted' ] [ 'logging' ] [ 'selector' ] in [ None , 'None' ] ) ) : facts [ 'hosted' ] [ 'logging' ] [ 'selector' ] = None return facts
set selectors facts if not already present in facts dict args: facts : existing facts returns: dict: the facts dict updated with the generated selectors facts if they were not already present .