mirror of
https://github.com/ansible/awx.git
synced 2026-02-02 10:08:10 -03:30
Fix controller_oauthtoken regression and more
* aap_token now functions like controller_oauthtoken
* lookup('awx.awx.controller_api', ...) fixed
This commit is contained in:
committed by
Chris Meyers
parent
11f31ef796
commit
e82de50edb
@@ -73,6 +73,7 @@ class ControllerModule(AnsibleModule):
|
||||
aap_token=dict(
|
||||
type='raw',
|
||||
no_log=True,
|
||||
aliases=['controller_oauthtoken',],
|
||||
required=False,
|
||||
fallback=(env_fallback, ['CONTROLLER_OAUTH_TOKEN', 'TOWER_OAUTH_TOKEN', 'AAP_TOKEN'])
|
||||
),
|
||||
@@ -129,18 +130,18 @@ class ControllerModule(AnsibleModule):
|
||||
if direct_value is not None:
|
||||
setattr(self, short_param, direct_value)
|
||||
|
||||
# Perform magic depending on whether controller_oauthtoken is a string or a dict
|
||||
if self.params.get('controller_oauthtoken'):
|
||||
token_param = self.params.get('controller_oauthtoken')
|
||||
# Perform magic depending on whether aap_token is a string or a dict
|
||||
if self.params.get('aap_token'):
|
||||
token_param = self.params.get('aap_token')
|
||||
if isinstance(token_param, dict):
|
||||
if 'token' in token_param:
|
||||
self.oauth_token = self.params.get('controller_oauthtoken')['token']
|
||||
self.oauth_token = self.params.get('aap_token')['token']
|
||||
else:
|
||||
self.fail_json(msg="The provided dict in controller_oauthtoken did not properly contain the token entry")
|
||||
self.fail_json(msg="The provided dict in aap_token did not properly contain the token entry")
|
||||
elif isinstance(token_param, string_types):
|
||||
self.oauth_token = self.params.get('controller_oauthtoken')
|
||||
self.oauth_token = self.params.get('aap_token')
|
||||
else:
|
||||
error_msg = "The provided controller_oauthtoken type was not valid ({0}). Valid options are str or dict.".format(type(token_param).__name__)
|
||||
error_msg = "The provided aap_token type was not valid ({0}). Valid options are str or dict.".format(type(token_param).__name__)
|
||||
self.fail_json(msg=error_msg)
|
||||
|
||||
# Perform some basic validation
|
||||
|
||||
Reference in New Issue
Block a user