mirror of
https://github.com/ansible/awx.git
synced 2026-02-12 07:04:45 -03:30
Fix tower_* modules **params kwargs (#40137)
* Add cleaning function to handle **params The cleaning function is only added to tower modules which pass a `**params` argument as an unpacked dictionnary to the tower-cli method calls. Fix #39745 * Remove previous code added only for tower_role In 872a7b4, the `update_resources` function was modified so that it would clear unwanted parameters. However, this behaviour is desired for other modules too, modified in another commit. (see tower_clean_params).
This commit is contained in:
@@ -45,7 +45,7 @@ def tower_auth_config(module):
|
||||
it will attempt to fetch values from the module pararms and
|
||||
only pass those values that have been set.
|
||||
'''
|
||||
config_file = module.params.get('tower_config_file')
|
||||
config_file = module.params.pop('tower_config_file', None)
|
||||
if config_file:
|
||||
config_file = os.path.expanduser(config_file)
|
||||
if not os.path.exists(config_file):
|
||||
@@ -57,16 +57,16 @@ def tower_auth_config(module):
|
||||
return parser.string_to_dict(f.read())
|
||||
else:
|
||||
auth_config = {}
|
||||
host = module.params.get('tower_host')
|
||||
host = module.params.pop('tower_host', None)
|
||||
if host:
|
||||
auth_config['host'] = host
|
||||
username = module.params.get('tower_username')
|
||||
username = module.params.pop('tower_username', None)
|
||||
if username:
|
||||
auth_config['username'] = username
|
||||
password = module.params.get('tower_password')
|
||||
password = module.params.pop('tower_password', None)
|
||||
if password:
|
||||
auth_config['password'] = password
|
||||
verify_ssl = module.params.get('tower_verify_ssl')
|
||||
verify_ssl = module.params.pop('tower_verify_ssl', None)
|
||||
if verify_ssl is not None:
|
||||
auth_config['verify_ssl'] = verify_ssl
|
||||
return auth_config
|
||||
|
||||
Reference in New Issue
Block a user