def query_metadata(metadata_url, headers=None, expect_json=False):
 (result, info) = fetch_url(module, metadata_url, headers=headers)
 if (info['status'] != 200):
  raise OpenShiftFactsMetadataUnavailableError('Metadata unavailable')
 if expect_json:
  return module.from_json(to_native(result.read()))
 else:
  return [to_native(line.strip()) for line in result.readlines()]

def query_metadata ( metadata_url , headers = None , expect_json = False ) : ( result , info ) = fetch_url ( module , metadata_url , headers = headers ) if ( info [ 'status' ] != 200 ) : raise OpenShiftFactsMetadataUnavailableError ( 'Metadata unavailable' ) if expect_json : return module . from_json ( to_native ( result . read ( ) ) ) else : return [ to_native ( line . strip ( ) ) for line in result . readlines ( ) ]
return metadata from the provided metadata_url args: metadata_url : metadata url headers : headers to set for metadata request expect_json : does the metadata_url return json returns: dict or list: metadata request result .