mirror of
https://github.com/ansible/awx.git
synced 2026-02-17 03:00:04 -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:
@@ -134,7 +134,7 @@ def main():
|
||||
name = module.params.get('name')
|
||||
inventory = module.params.get('inventory')
|
||||
credential = module.params.get('credential')
|
||||
state = module.params.get('state')
|
||||
state = module.params.pop('state')
|
||||
|
||||
variables = module.params.get('variables')
|
||||
if variables:
|
||||
|
||||
@@ -222,7 +222,7 @@ def main():
|
||||
module.fail_json(msg='ansible-tower-cli required for this module')
|
||||
|
||||
name = module.params.get('name')
|
||||
state = module.params.get('state')
|
||||
state = module.params.pop('state')
|
||||
json_output = {'job_template': name, 'state': state}
|
||||
|
||||
tower_auth = tower_auth_config(module)
|
||||
|
||||
@@ -87,10 +87,6 @@ def update_resources(module, p):
|
||||
by name using their unique field (identity)
|
||||
'''
|
||||
params = p.copy()
|
||||
for key in p:
|
||||
if key.startswith('tower_'):
|
||||
params.pop(key)
|
||||
params.pop('state', None)
|
||||
identity_map = {
|
||||
'user': 'username',
|
||||
'team': 'name',
|
||||
@@ -134,7 +130,7 @@ def main():
|
||||
module.fail_json(msg='ansible-tower-cli required for this module')
|
||||
|
||||
role_type = module.params.pop('role')
|
||||
state = module.params.get('state')
|
||||
state = module.params.pop('state')
|
||||
|
||||
json_output = {'role': role_type, 'state': state}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user