Commit a0df2493 authored by Carlos Torres's avatar Carlos Torres
Browse files

Merge branch 'feature/do-not-create-deployment' into 'develop'

Don't create a new deployment site

See merge request !22
parents 237d765d 2ac86825
......@@ -66,6 +66,17 @@ def main():
"Deployment tags. It is a comma separated string of tags."
)
)
parser.add_argument(
"-nds",
"--do-not-create-deployment",
dest="do_not_create_deployment",
action='store_true',
help=(
"If passed the deployment site is not created, and just the link "
"between the domains, and the deployments with the same tags will "
"be done."
)
)
args = parser.parse_args()
if args.install_dirs and args.auth_token and args.domains:
try:
......@@ -85,46 +96,51 @@ def main():
str(domains)
)
)
deployment_data = create_deployment_site(
auth_token,
description=description,
tags=deployment_tags
create_deployment = not (
hasattr(args, 'do_not_create_deployment') and
args.do_not_create_deployment
)
if deployment_data and 'error' not in deployment_data.keys():
deployment_id = deployment_data['deployment_id']
link_deployment_site_to_domains(
domains,
deployment_id,
auth_token
)
deployment_site_long_name = (
deployment_data['deployment_site_long_name']
if create_deployment:
deployment_data = create_deployment_site(
auth_token,
description=description,
tags=deployment_tags
)
if not deployment_site_long_name:
raise Exception(
'Error: entry_point:main the Accelerator '
'Platform API returned empty '
'deployment_site_long_name or '
'deployment_site_long_secret which are '
'required to run the sc_pack. It is probably '
'due to the cloud service is temporary down, '
'please try again a few minutes later.'
if deployment_data and 'error' not in deployment_data.keys():
deployment_id = deployment_data['deployment_id']
link_deployment_site_to_domains(
domains,
deployment_id,
auth_token
)
update_sc_pack_config_file(
install_dir,
deployment_site_long_name,
deployment_data['deployment_site_long_secret']
)
else:
error = deployment_data['error']
raise Exception(
'Error creating credentials. '
'Response status code: {}, '
'response content: {}.'.format(
error['response_status_code'],
error['response_content'],
deployment_site_long_name = (
deployment_data['deployment_site_long_name']
)
if not deployment_site_long_name:
raise Exception(
'Error: entry_point:main the Accelerator '
'Platform API returned empty '
'deployment_site_long_name or '
'deployment_site_long_secret which are '
'required to run the sc_pack. It is probably '
'due to the cloud service is temporary down, '
'please try again a few minutes later.'
)
update_sc_pack_config_file(
install_dir,
deployment_site_long_name,
deployment_data['deployment_site_long_secret']
)
else:
error = deployment_data['error']
raise Exception(
'Error creating credentials. '
'Response status code: {}, '
'response content: {}.'.format(
error['response_status_code'],
error['response_content'],
)
)
)
link_domains_with_deployments_with_tags(
domains,
deployment_tags,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment