def _deploy_app(): if _is_sanity_dep_exist(should_fail=True): return dep_inputs = {'server_ip': manager_ip, 'agent_user': manager_user, 'agent_private_key_path': manager_remote_key_path} data = { 'blueprint_id': BLUEPRINT_ID, 'inputs': dep_inputs } headers = utils.create_maintenance_headers() headers.update({'content-type': 'application/json'}) utils.http_request( '{0}/deployments/{1}'.format(_get_url_prefix(), DEPLOYMENT_ID), data=json.dumps(data), headers=headers) # Waiting for create deployment env to end utils.repetitive( utils.wait_for_workflow, deployment_id=DEPLOYMENT_ID, workflow_id='create_deployment_environment', url_prefix=_get_url_prefix(), timeout_msg='Timed out while waiting for ' 'deployment {0} to be created'.format(DEPLOYMENT_ID))
def _install_sanity_app(): data = { 'deployment_id': DEPLOYMENT_ID, 'workflow_id': 'install' } headers = utils.create_maintenance_headers() headers.update({'content-type': 'application/json'}) resp = utils.http_request( '{0}/executions'.format(_get_url_prefix()), method='POST', data=json.dumps(data), headers=headers) # Waiting for installation to complete utils.repetitive( utils.wait_for_workflow, timeout=5*60, interval=30, deployment_id=DEPLOYMENT_ID, workflow_id='install', url_prefix=_get_url_prefix(), timeout_msg='Timed out while waiting for ' 'deployment {0} to install'.format(DEPLOYMENT_ID)) resp_content = resp.readlines() json_resp = json.loads(resp_content[0]) return json_resp['id']
def _deploy_app(): if _is_sanity_dep_exist(should_fail=True): return dep_inputs = { 'server_ip': manager_ip, 'agent_user': manager_user, 'agent_private_key_path': manager_remote_key_path } data = {'blueprint_id': BLUEPRINT_ID, 'inputs': dep_inputs} headers = utils.create_maintenance_headers() headers.update({'content-type': 'application/json'}) utils.http_request('{0}/deployments/{1}'.format(_get_url_prefix(), DEPLOYMENT_ID), data=json.dumps(data), headers=headers) # Waiting for create deployment env to end utils.repetitive(utils.wait_for_workflow, deployment_id=DEPLOYMENT_ID, workflow_id='create_deployment_environment', url_prefix=_get_url_prefix(), timeout=60, timeout_msg='Timed out while waiting for ' 'deployment {0} to be created'.format(DEPLOYMENT_ID))
def _uninstall_sanity_app(): if not _is_sanity_dep_exist(): return data = { 'deployment_id': DEPLOYMENT_ID, 'workflow_id': 'uninstall' } headers = utils.create_maintenance_headers() headers.update({'content-type': 'application/json'}) utils.http_request( '{0}/executions'.format(_get_url_prefix()), method='POST', data=json.dumps(data), headers=headers) # Waiting for installation to complete utils.repetitive( utils.wait_for_workflow, timeout=5*60, interval=30, deployment_id=DEPLOYMENT_ID, workflow_id='uninstall', url_prefix=_get_url_prefix(), timeout_msg='Timed out while waiting for ' 'deployment {0} to uninstall.'.format(DEPLOYMENT_ID))
def _install_sanity_app(client): execution = client.executions.start(DEPLOYMENT_ID, 'install') utils.repetitive(wait_for_workflow, client=client, deployment_id=DEPLOYMENT_ID, workflow_id='install', timeout=5 * 60, interval=5, timeout_msg='Timed out while waiting for ' 'deployment {0} to install'.format(DEPLOYMENT_ID)) return execution.id
def _uninstall_sanity_app(client): if not _is_sanity_dep_exist(client): return client.executions.start(DEPLOYMENT_ID, 'uninstall') # Waiting for uninstallation to complete utils.repetitive(wait_for_workflow, client=client, deployment_id=DEPLOYMENT_ID, workflow_id='uninstall', timeout=5 * 60, interval=5, timeout_msg='Timed out while waiting for ' 'deployment {0} to uninstall'.format(DEPLOYMENT_ID))
def _deploy_app(client): if _is_sanity_dep_exist(client): return client.deployments.create(BLUEPRINT_ID, DEPLOYMENT_ID, inputs={ 'server_ip': '127.0.0.1', 'agent_user': os.environ.get('ssh_user'), 'agent_private_key_path': manager_remote_key_path }) # Waiting for create deployment env to end utils.repetitive(wait_for_workflow, client=client, deployment_id=DEPLOYMENT_ID, workflow_id='create_deployment_environment', timeout=60, timeout_msg='Timed out while waiting for ' 'deployment {0} to be created'.format(DEPLOYMENT_ID))
def _uninstall_sanity_app(): if not _is_sanity_dep_exist(): return data = {'deployment_id': DEPLOYMENT_ID, 'workflow_id': 'uninstall'} headers = utils.create_maintenance_headers() headers.update({'content-type': 'application/json'}) utils.http_request('{0}/executions'.format(_get_url_prefix()), method='POST', data=json.dumps(data), headers=headers) # Waiting for installation to complete utils.repetitive(utils.wait_for_workflow, timeout=5 * 60, interval=30, deployment_id=DEPLOYMENT_ID, workflow_id='uninstall', url_prefix=_get_url_prefix(), timeout_msg='Timed out while waiting for ' 'deployment {0} to uninstall.'.format(DEPLOYMENT_ID))
def _install_sanity_app(): data = {'deployment_id': DEPLOYMENT_ID, 'workflow_id': 'install'} headers = utils.create_maintenance_headers() headers.update({'content-type': 'application/json'}) resp = utils.http_request('{0}/executions'.format(_get_url_prefix()), method='POST', data=json.dumps(data), headers=headers) # Waiting for installation to complete utils.repetitive(utils.wait_for_workflow, timeout=5 * 60, interval=30, deployment_id=DEPLOYMENT_ID, workflow_id='install', url_prefix=_get_url_prefix(), timeout_msg='Timed out while waiting for ' 'deployment {0} to install'.format(DEPLOYMENT_ID)) resp_content = resp.readlines() json_resp = json.loads(resp_content[0]) return json_resp['id']