mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-06 22:24:23 -07: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
afdd4e2343
commit
65c7424a35
3 changed files with 36 additions and 1 deletions
|
@ -146,7 +146,11 @@ def main():
|
|||
if scm_credential:
|
||||
try:
|
||||
cred_res = tower_cli.get_resource('credential')
|
||||
cred = cred_res.get(name=scm_credential)
|
||||
try:
|
||||
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']
|
||||
except (exc.NotFound) as excinfo:
|
||||
module.fail_json(msg='Failed to update project, credential not found: {0}'.format(scm_credential), changed=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue