mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 09:27:36 -02:30
tower cred: support credential kind/type for /api/v1/ and /api/v2/ (#36662)
older versions of Tower (3.1) don't have a concept of CredentialTypes (this was introduced in Tower 3.2). This change detects older versions of pre-3.2 tower-cli that *only* support the deprecated `kind` attribute.
This commit is contained in:
committed by
AlanCoding
parent
d192297987
commit
2edca4f357
@@ -258,8 +258,16 @@ def main():
|
|||||||
org = org_res.get(name=organization)
|
org = org_res.get(name=organization)
|
||||||
params['organization'] = org['id']
|
params['organization'] = org['id']
|
||||||
|
|
||||||
credential_type = credential_type_for_v1_kind(module.params, module)
|
try:
|
||||||
params['credential_type'] = credential_type['id']
|
tower_cli.get_resource('credential_type')
|
||||||
|
except (AttributeError):
|
||||||
|
# /api/v1/ backwards compat
|
||||||
|
# older versions of tower-cli don't *have* a credential_type
|
||||||
|
# resource
|
||||||
|
params['kind'] = module.params['kind']
|
||||||
|
else:
|
||||||
|
credential_type = credential_type_for_v1_kind(module.params, module)
|
||||||
|
params['credential_type'] = credential_type['id']
|
||||||
|
|
||||||
if module.params.get('description'):
|
if module.params.get('description'):
|
||||||
params['description'] = module.params.get('description')
|
params['description'] = module.params.get('description')
|
||||||
|
|||||||
Reference in New Issue
Block a user