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
Add rc code to docker_creds module #9286
Add rc code to docker_creds module #9286
Conversation
This commit ensures that successful attempts at creating registry credentials returns an rc == 0. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1602120
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.
In order for a task to effectively use 'rc', this module will also need to return 'rc' from each instance of module.fail_json
as well.
Alternatively, to use retries with this module, the (three) tasks that use this module could be updated to use the failed status which is already reported.
until: not (foo_oreg_auth_credentials_create is failed)
@mtnbikenc I tried with forcing it to fail by a bad set of credentials, it works as expected; module.fail_json provides the rc=1 condition by default. FAILED - RETRYING: Create credentials for docker cli registry auth (alternative) (1 retries left).Result was: {
"attempts": 3,
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_qutONp/ansible_module_docker_creds.py\", line 237, in <module>\n main()\n File \"/tmp/ansible_qutONp/ansible_module_docker_creds.py\", line 233, in main\n run_module()\n File \"/tmp/ansible_qutONp/ansible_module_docker_creds.py\", line 219, in run_module\n validate_registry_login(module, registry, encoded_auth)\n File \"/tmp/ansible_qutONp/ansible_module_docker_creds.py\", line 141, in validate_registry_login\n urllib.request.urlopen(req)\n File \"/usr/lib64/python2.7/urllib2.py\", line 154, in urlopen\n return opener.open(url, data, timeout)\n File \"/usr/lib64/python2.7/urllib2.py\", line 429, in open\n response = self._open(req, data)\n File \"/usr/lib64/python2.7/urllib2.py\", line 447, in _open\n '_open', req)\n File \"/usr/lib64/python2.7/urllib2.py\", line 407, in _call_chain\n result = func(*args)\n File \"/usr/lib64/python2.7/urllib2.py\", line 1243, in https_open\n context=self._context)\n File \"/usr/lib64/python2.7/urllib2.py\", line 1200, in do_open\n raise URLError(err)\nurllib2.URLError: <urlopen error [Errno -2] Name or service not known>\n",
"module_stdout": "",
"msg": "MODULE FAILURE",
"rc": 1,
"retries": 4
} |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: michaelgugino, mtnbikenc The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This commit ensures that successful attempts at creating
registry credentials returns an rc == 0.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1602120