def __get_metadata(vm_):
 md = config.get_cloud_config_value('metadata', vm_, __opts__, default='{}', search_global=False)
 try:
  metadata = literal_eval(md)
 except Exception:
  metadata = None
 if ((not metadata) or (not isinstance(metadata, dict))):
  metadata = {'items': [{'key': 'salt-cloud-profile', 'value': vm_['profile']}]}
 else:
  metadata['salt-cloud-profile'] = vm_['profile']
  items = []
  for (k, v) in six.iteritems(metadata):
   items.append({'key': k, 'value': v})
  metadata = {'items': items}
 return metadata

def __get_metadata ( vm_ ) : md = config . get_cloud_config_value ( 'metadata' , vm_ , __opts__ , default = '{}' , search_global = False ) try : metadata = literal_eval ( md ) except Exception : metadata = None if ( ( not metadata ) or ( not isinstance ( metadata , dict ) ) ) : metadata = { 'items' : [ { 'key' : 'salt-cloud-profile' , 'value' : vm_ [ 'profile' ] } ] } else : metadata [ 'salt-cloud-profile' ] = vm_ [ 'profile' ] items = [ ] for ( k , v ) in six . iteritems ( metadata ) : items . append ( { 'key' : k , 'value' : v } ) metadata = { 'items' : items } return metadata
get configured metadata and add salt-cloud-profile .