Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _deploy_indexer(e, version):
if is_fourfront_env(e):
description = try_to_describe_indexer_env(FF_ENV_INDEXER)
else:
description = try_to_describe_indexer_env(CGAP_ENV_INDEXER)
if description is not None:
check.status = 'ERROR'
check.summary = 'Tried to spin up indexer env for %s when one already exists for this portal' % e
return False
else:
return EBDeployer.deploy_indexer(e, version)
def terminate_indexer_server(connection, **kwargs):
""" Terminates the index_server stored in the full_output member of the associated check above """
action = ActionResult(connection, 'terminate_indexer_server')
related_indexer_server_status = action.get_associated_check_result(kwargs)
forced_env = kwargs.get('forced_env', None)
env_to_terminate = related_indexer_server_status.get('full_output', None) if forced_env is None else forced_env
if env_to_terminate:
client = boto3.client('elasticbeanstalk')
success = EBDeployer.terminate_indexer_env(client, env_to_terminate)
if success:
action.status = 'DONE'
action.output = 'Successfully triggered termination of indexer env %s' % env_to_terminate
else:
action.status = 'FAIL'
action.output = 'Encountered an error while issuing terminate call, please check the AWS EB Console'
else:
action.status = 'FAIL'
action.output = 'Did not get an env_to_terminate from the associated check - bad action call?'
return action