def get_id(opts, cache_minion_id=False):
 if (opts['root_dir'] is None):
  root_dir = salt.syspaths.ROOT_DIR
 else:
  root_dir = opts['root_dir']
 config_dir = salt.syspaths.CONFIG_DIR
 if config_dir.startswith(salt.syspaths.ROOT_DIR):
  config_dir = config_dir.split(salt.syspaths.ROOT_DIR, 1)[(-1)]
 id_cache = os.path.join(root_dir, config_dir.lstrip(os.path.sep), 'minion_id')
 if opts.get('minion_id_caching', True):
  try:
   with salt.utils.fopen(id_cache) as idf:
    name = idf.readline().strip()
    bname = salt.utils.to_bytes(name)
    if bname.startswith(codecs.BOM):
     name = salt.utils.to_str(bname.replace(codecs.BOM, '', 1))
   if (name and (name != 'localhost')):
    log.debug('Using cached minion ID from {0}: {1}'.format(id_cache, name))
    return (name, False)
  except (IOError, OSError):
   pass
 if (('__role' in opts) and (opts.get('__role') == 'minion')):
  log.debug('Guessing ID. The id can be explicitly set in {0}'.format(os.path.join(salt.syspaths.CONFIG_DIR, 'minion')))
 newid = salt.utils.network.generate_minion_id()
 if (('__role' in opts) and (opts.get('__role') == 'minion')):
  log.debug('Found minion id from generate_minion_id(): {0}'.format(newid))
 if (cache_minion_id and opts.get('minion_id_caching', True)):
  _cache_id(newid, id_cache)
 is_ipv4 = salt.utils.network.is_ipv4(newid)
 return (newid, is_ipv4)

def get_id ( opts , cache_minion_id = False ) : if ( opts [ 'root_dir' ] is None ) : root_dir = salt . syspaths . ROOT_DIR else : root_dir = opts [ 'root_dir' ] config_dir = salt . syspaths . CONFIG_DIR if config_dir . startswith ( salt . syspaths . ROOT_DIR ) : config_dir = config_dir . split ( salt . syspaths . ROOT_DIR , 1 ) [ ( - 1 ) ] id_cache = os . path . join ( root_dir , config_dir . lstrip ( os . path . sep ) , 'minion_id' ) if opts . get ( 'minion_id_caching' , True ) : try : with salt . utils . fopen ( id_cache ) as idf : name = idf . readline ( ) . strip ( ) bname = salt . utils . to_bytes ( name ) if bname . startswith ( codecs . BOM ) : name = salt . utils . to_str ( bname . replace ( codecs . BOM , '' , 1 ) ) if ( name and ( name != 'localhost' ) ) : log . debug ( 'Using cached minion ID from {0}: {1}' . format ( id_cache , name ) ) return ( name , False ) except ( IOError , OSError ) : pass if ( ( '__role' in opts ) and ( opts . get ( '__role' ) == 'minion' ) ) : log . debug ( 'Guessing ID. The id can be explicitly set in {0}' . format ( os . path . join ( salt . syspaths . CONFIG_DIR , 'minion' ) ) ) newid = salt . utils . network . generate_minion_id ( ) if ( ( '__role' in opts ) and ( opts . get ( '__role' ) == 'minion' ) ) : log . debug ( 'Found minion id from generate_minion_id(): {0}' . format ( newid ) ) if ( cache_minion_id and opts . get ( 'minion_id_caching' , True ) ) : _cache_id ( newid , id_cache ) is_ipv4 = salt . utils . network . is_ipv4 ( newid ) return ( newid , is_ipv4 )
given vpc properties .