Skip to content
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

Merged
merged 1 commit into from Jul 20, 2018

Conversation

michaelgugino
Copy link
Contributor

This commit ensures that successful attempts at creating
registry credentials returns an rc == 0.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1602120

This commit ensures that successful attempts at creating
registry credentials returns an rc == 0.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1602120
@openshift-ci-robot openshift-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 20, 2018
Copy link
Member

@mtnbikenc mtnbikenc left a 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)

@michaelgugino
Copy link
Contributor Author

@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
}

Copy link
Member

@mtnbikenc mtnbikenc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 20, 2018
@openshift-ci-robot
Copy link

[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:
  • OWNERS [michaelgugino,mtnbikenc]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sdodson sdodson merged commit 72d777f into openshift:master Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants