mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
tower_project: manual projects don't require creds
This commit is contained in:
parent
358c759bd9
commit
4e275a4ba8
1 changed files with 9 additions and 6 deletions
|
@ -146,16 +146,19 @@ def main():
|
||||||
org = org_res.get(name=organization)
|
org = org_res.get(name=organization)
|
||||||
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:
|
||||||
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)
|
||||||
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=cred['id'],
|
scm_branch=scm_branch, scm_clean=scm_clean, credential=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)
|
||||||
|
|
Loading…
Reference in a new issue