in tools/genconfig/genconfig.py [0:0]
def get_config(urls, project):
"""Given a set of resource URLs, returns a DM config.
The DM config will contain a resource for each URL provided, filled with the
appropriate type and properties from the live resource.
All instances of the specified project will be replaced with
"{{ env['project'] }}".
Args:
urls: the list of resource URLs to process into config
project: the project for the associated resources
Returns:
A valid DM config containing all resources from the URL list.
Raises:
Exception: if any URLs or resources are invalid.
"""
resources = []
for cmd in get_gcloud_cmds(urls, project):
if not cmd:
continue
useShell = sys.platform == 'win32'
props = check_output(cmd.split(), shell=useShell)
resources.extend(get_resource_config(props, project, urls))
return {'resources': resources}