mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
Added organization in the scm_credential get (#49884)
* Added organization in the scm_credential get * Fallback looking for cred in project org * Tests project with multi org credential * Fixed CI issue * Added changelog fragment
This commit is contained in:
parent
b11374157d
commit
a37a18c0bf
@ -146,7 +146,11 @@ def main():
|
|||||||
if scm_credential:
|
if scm_credential:
|
||||||
try:
|
try:
|
||||||
cred_res = tower_cli.get_resource('credential')
|
cred_res = tower_cli.get_resource('credential')
|
||||||
|
try:
|
||||||
cred = cred_res.get(name=scm_credential)
|
cred = cred_res.get(name=scm_credential)
|
||||||
|
except (tower_cli.exceptions.MultipleResults) as multi_res_excinfo:
|
||||||
|
module.warn('Multiple credentials found for {0}, falling back looking in project organization'.format(scm_credential))
|
||||||
|
cred = cred_res.get(name=scm_credential, organization=org['id'])
|
||||||
scm_credential = cred['id']
|
scm_credential = cred['id']
|
||||||
except (exc.NotFound) as excinfo:
|
except (exc.NotFound) as excinfo:
|
||||||
module.fail_json(msg='Failed to update project, credential not found: {0}'.format(scm_credential), changed=False)
|
module.fail_json(msg='Failed to update project, credential not found: {0}'.format(scm_credential), changed=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user