forked from p15670423/monkey
Moved region update to beginning of auth function
So it'll work without auth params as well
This commit is contained in:
parent
6216ac0e9e
commit
9c38d8e72a
|
@ -45,15 +45,11 @@ class RemoteRun(flask_restful.Resource):
|
||||||
body = json.loads(request.data)
|
body = json.loads(request.data)
|
||||||
resp = {}
|
resp = {}
|
||||||
if body.get('type') == 'aws':
|
if body.get('type') == 'aws':
|
||||||
#is_auth = RemoteRunAwsService.update_aws_auth_params()
|
is_auth = RemoteRunAwsService.update_aws_auth_params()
|
||||||
#resp['auth'] = is_auth
|
resp['auth'] = is_auth
|
||||||
#if is_auth:
|
if is_auth:
|
||||||
# result = self.run_aws_monkeys(body)
|
result = self.run_aws_monkeys(body)
|
||||||
# resp['result'] = result
|
resp['result'] = result
|
||||||
#else:
|
|
||||||
RemoteRunAwsService.update_aws_region_authless()
|
|
||||||
result = self.run_aws_monkeys(body)
|
|
||||||
resp['result'] = result
|
|
||||||
return jsonify(resp)
|
return jsonify(resp)
|
||||||
|
|
||||||
# default action
|
# default action
|
||||||
|
|
|
@ -51,6 +51,8 @@ class RemoteRunAwsService:
|
||||||
Updates the AWS authentication parameters according to config
|
Updates the AWS authentication parameters according to config
|
||||||
:return: True if new params allow successful authentication. False otherwise
|
:return: True if new params allow successful authentication. False otherwise
|
||||||
"""
|
"""
|
||||||
|
AwsService.set_region(RemoteRunAwsService.aws_instance.region)
|
||||||
|
|
||||||
access_key_id = ConfigService.get_config_value(['cnc', 'aws_config', 'aws_access_key_id'], False, True)
|
access_key_id = ConfigService.get_config_value(['cnc', 'aws_config', 'aws_access_key_id'], False, True)
|
||||||
secret_access_key = ConfigService.get_config_value(['cnc', 'aws_config', 'aws_secret_access_key'], False, True)
|
secret_access_key = ConfigService.get_config_value(['cnc', 'aws_config', 'aws_secret_access_key'], False, True)
|
||||||
|
|
||||||
|
@ -58,8 +60,6 @@ class RemoteRunAwsService:
|
||||||
AwsService.set_auth_params(access_key_id, secret_access_key)
|
AwsService.set_auth_params(access_key_id, secret_access_key)
|
||||||
RemoteRunAwsService.is_auth = AwsService.test_client()
|
RemoteRunAwsService.is_auth = AwsService.test_client()
|
||||||
|
|
||||||
AwsService.set_region(RemoteRunAwsService.aws_instance.region)
|
|
||||||
|
|
||||||
return RemoteRunAwsService.is_auth
|
return RemoteRunAwsService.is_auth
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue