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

Move update_cache to after self.yum_baseurl definition #56613

Merged
merged 1 commit into from May 21, 2019

Conversation

Zeophlite
Copy link
Contributor

SUMMARY

#46183 allows the yum and dnf modules to update_cache without passing in any packages. There is a bug where self.yum_basecmd is called before it is declared. This patch moves the self.yum_basecmd declaration up several lines.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

yum

ADDITIONAL INFORMATION
[user@server ~]$ ansible localhost -e ansible_python_interpreter=/usr/bin/python2.7 -m yum -a "disablerepo=\"*\" enablerepo=\"some-repo\" update_cache=yes" --become
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'YumModule' object has no attribute 'yum_basecmd'
localhost | FAILED! => {
    "ansible_facts": {
        "pkg_mgr": "yum"
    },
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/.ansible/tmp/ansible-tmp-1558243188.749404-268779056159653/AnsiballZ_yum.py\", line 114, in <module>\n    _ansiballz_main()\n  File \"/tmp/.ansible/tmp/ansible-tmp-1558243188.749404-268779056159653/AnsiballZ_yum.py\", line 106, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/tmp/.ansible/tmp/ansible-tmp-1558243188.749404-268779056159653/AnsiballZ_yum.py\", line 49, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/tmp/ansible_yum_payload_z85En8/__main__.py\", line 1608, in <module>\n  File \"/tmp/ansible_yum_payload_z85En8/__main__.py\", line 1604, in main\n  File \"/tmp/ansible_yum_payload_z85En8/__main__.py\", line 1498, in run\nAttributeError: 'YumModule' object has no attribute 'yum_basecmd'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

After patch:

[user@server ~]$ ansible localhost -e ansible_python_interpreter=/usr/bin/python2.7 -m yum -a "disablerepo=\"*\" enablerepo=\"some-repo\" update_cache=yes" --become
localhost | SUCCESS => {
    "ansible_facts": {
        "pkg_mgr": "yum"
    },
    "changed": false,
    "msg": "Cache updated",
    "rc": 0,
    "results": []
}

@ansibot
Copy link
Contributor

ansibot commented May 19, 2019

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. packaging Packaging category support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback. labels May 19, 2019
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label May 21, 2019
@mkrizek mkrizek merged commit e135661 into ansible:devel May 21, 2019
mkrizek pushed a commit to mkrizek/ansible that referenced this pull request May 21, 2019
abadger pushed a commit that referenced this pull request May 22, 2019
…56705)

* Move update_cache to after self.yum_baseurl definition (#56613)


(cherry picked from commit e135661)

* Add changelog
@ansible ansible locked and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. new_contributor This PR is the first contribution by a new community member. packaging Packaging category support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants