Trying to update the region and then to call remote run

Without auth first
This commit is contained in:
Shay Nehmad 2019-04-16 21:13:36 +03:00
parent 4741151f22
commit 6216ac0e9e
2 changed files with 16 additions and 8 deletions

View File

@ -45,12 +45,13 @@ class RemoteRun(flask_restful.Resource):
body = json.loads(request.data)
resp = {}
if body.get('type') == 'aws':
is_auth = RemoteRunAwsService.update_aws_auth_params()
resp['auth'] = is_auth
if is_auth:
result = self.run_aws_monkeys(body)
resp['result'] = result
else:
#is_auth = RemoteRunAwsService.update_aws_auth_params()
#resp['auth'] = is_auth
#if is_auth:
# result = self.run_aws_monkeys(body)
# resp['result'] = result
#else:
RemoteRunAwsService.update_aws_region_authless()
result = self.run_aws_monkeys(body)
resp['result'] = result
return jsonify(resp)

View File

@ -62,6 +62,13 @@ class RemoteRunAwsService:
return RemoteRunAwsService.is_auth
@staticmethod
def update_aws_region_authless():
"""
Updates the AWS region without auth params (via IAM role)
"""
AwsService.set_region(RemoteRunAwsService.aws_instance.region)
@staticmethod
def get_bitness(instances):
"""