New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly detect credentials for tower_project #43215
Conversation
try: | ||
cred_res = tower_cli.get_resource('credential') | ||
cred = cred_res.get(name=scm_credential) | ||
except (exc.NotFound) as excinfo: | ||
module.fail_json(msg='Failed to update project, credential not found: {0}'.format(scm_credential), changed=False) | ||
credential = cred['id'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not have a variable scm_credential
and credential
. You could just call this scm_credential
, and supply that in the project.modify
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
name: git project | ||
organization: Default | ||
scm_type: git | ||
scm_url: https://github.com/ansible/ansible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great 👍
@@ -104,7 +104,7 @@ def main(): | |||
scm_type=dict(choices=['manual', 'git', 'hg', 'svn'], default='manual'), | |||
scm_url=dict(), | |||
scm_branch=dict(), | |||
scm_credential=dict(), | |||
scm_credential=dict(default=None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't None
the default value already ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, good point, I somehow felt the need to make it explicity. Let me fix that.
shipit |
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.
LGTM : test is executed and run without any error. |
shipit |
@AlanCoding I think your shipit doesn't count because I did a slight modification afterwards :/ |
shipit |
SUMMARY
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, for example.
ISSUE TYPE
COMPONENT NAME
tower_project
ANSIBLE VERSION
ADDITIONAL INFORMATION
Before:
After: