mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
Properly detect credentials for tower_project
It seemed like it was mostly the wrong variables been looked at, making it so a git repository could not be created without a credential.
This commit is contained in:
committed by
AlanCoding
parent
1349449e1e
commit
9b228d7d2d
@@ -147,18 +147,18 @@ def main():
|
|||||||
except (exc.NotFound) as excinfo:
|
except (exc.NotFound) as excinfo:
|
||||||
module.fail_json(msg='Failed to update project, organization not found: {0}'.format(organization), changed=False)
|
module.fail_json(msg='Failed to update project, organization not found: {0}'.format(organization), changed=False)
|
||||||
|
|
||||||
if scm_type:
|
if scm_credential:
|
||||||
try:
|
try:
|
||||||
cred_res = tower_cli.get_resource('credential')
|
cred_res = tower_cli.get_resource('credential')
|
||||||
cred = cred_res.get(name=scm_credential)
|
cred = cred_res.get(name=scm_credential)
|
||||||
|
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)
|
||||||
|
|
||||||
credential = cred['id'] if scm_type else None
|
|
||||||
result = project.modify(name=name, description=description,
|
result = project.modify(name=name, description=description,
|
||||||
organization=org['id'],
|
organization=org['id'],
|
||||||
scm_type=scm_type, scm_url=scm_url, local_path=local_path,
|
scm_type=scm_type, scm_url=scm_url, local_path=local_path,
|
||||||
scm_branch=scm_branch, scm_clean=scm_clean, credential=credential,
|
scm_branch=scm_branch, scm_clean=scm_clean, credential=scm_credential,
|
||||||
scm_delete_on_update=scm_delete_on_update,
|
scm_delete_on_update=scm_delete_on_update,
|
||||||
scm_update_on_launch=scm_update_on_launch,
|
scm_update_on_launch=scm_update_on_launch,
|
||||||
create_on_missing=True)
|
create_on_missing=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user