properly pass /api/v1/ credential fields for older Towers (#36917)
This commit is contained in:
parent
fe10685b01
commit
0e7106b106
1 changed files with 6 additions and 5 deletions
|
@ -282,7 +282,6 @@ def main():
|
||||||
team = team_res.get(name=module.params.get('team'))
|
team = team_res.get(name=module.params.get('team'))
|
||||||
params['team'] = team['id']
|
params['team'] = team['id']
|
||||||
|
|
||||||
params['inputs'] = {}
|
|
||||||
if module.params.get('ssh_key_data'):
|
if module.params.get('ssh_key_data'):
|
||||||
filename = module.params.get('ssh_key_data')
|
filename = module.params.get('ssh_key_data')
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
|
@ -290,15 +289,17 @@ def main():
|
||||||
if os.path.isdir(filename):
|
if os.path.isdir(filename):
|
||||||
module.fail_json(msg='attempted to read contents of directory: %s' % filename)
|
module.fail_json(msg='attempted to read contents of directory: %s' % filename)
|
||||||
with open(filename, 'rb') as f:
|
with open(filename, 'rb') as f:
|
||||||
params['inputs']['ssh_key_data'] = f.read()
|
module.params['ssh_key_data'] = f.read()
|
||||||
|
|
||||||
for key in ('authorize', 'authorize_password', 'client', 'secret',
|
for key in ('authorize', 'authorize_password', 'client', 'secret',
|
||||||
'tenant', 'subscription', 'domain', 'become_method',
|
'tenant', 'subscription', 'domain', 'become_method',
|
||||||
'become_username', 'become_password', 'vault_password',
|
'become_username', 'become_password', 'vault_password',
|
||||||
'project', 'host', 'username', 'password',
|
'project', 'host', 'username', 'password',
|
||||||
'ssh_key_unlock'):
|
'ssh_key_data', 'ssh_key_unlock'):
|
||||||
if module.params.get(key):
|
if 'kind' in params:
|
||||||
params['inputs'][key] = module.params.get(key)
|
params[key] = module.params.get(key)
|
||||||
|
elif module.params.get(key):
|
||||||
|
params.setdefault('inputs', {})[key] = module.params.get(key)
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
result = credential.modify(**params)
|
result = credential.modify(**params)
|
||||||
|
|
Loading…
Reference in a new issue