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
Do switch to apt if aptitude is not installed #30738
Conversation
Trying to use the apt module on a freshly install 16.04 Ubuntu VM with
"ansible -m apt -a 'name=* state=latest' all" fail with this backtrace:
Traceback (most recent call last):
File \"/tmp/ansible_2inxygge/ansible_module_apt.py\", line 1055, in <module>
main()
File \"/tmp/ansible_2inxygge/ansible_module_apt.py\", line 998, in main
upgrade(module, 'yes', force_yes, p['default_release'], use_apt_get, dpkg_options)
File \"/tmp/ansible_2inxygge/ansible_module_apt.py\", line 759, in upgrade
apt_cmd_path = m.get_bin_path(apt_cmd, required=True)
File \"/tmp/ansible_2inxygge/ansible_modlib.zip/ansible/module_utils/basic.py\", line 2182, in get_bin_path
File \"/usr/lib/python3.5/posixpath.py\", line 89, in join
genericpath._check_arg_types('join', a, *p)
File \"/usr/lib/python3.5/genericpath.py\", line 143, in _check_arg_types
(funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'
It seems that since aptitude is not installed on Xenial, so APTITUDE_CMD is None
and we later hit the bug in the upgrade function since it assume APTITUDE_CMD
is set.
|
@mscherer I can't reproduce the issue to test the patch. Running the following on newly installed Ubuntu 16.04: I get: Anything I am doing wrong? |
|
waiting_on_contributor |
| if not use_apt_get and not APTITUDE_CMD and p.get('upgrade', None) in ['full', 'safe', 'yes']: | ||
| module.warn("Could not find aptitude. Using apt-get instead.") | ||
| if not use_apt_get and not APTITUDE_CMD: | ||
| module.warn("Could not find aptitude. Using apt-get instead") |
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 is a tiny nit pick, but can you replace the period at the end of the warning?
|
rebuild_merge |
|
Does a MR cherry-picking this bugfix need to be opened to get this into the 2.7 line? https://docs.ansible.com/ansible/latest/community/development_process.html |
|
@Fxer yes, that will be needed |
Trying to use the apt module on a freshly install 16.04 Ubuntu VM with
"ansible -m apt -a 'name=* state=latest' all" fail with this backtrace:
Traceback (most recent call last):
File \"/tmp/ansible_2inxygge/ansible_module_apt.py\", line 1055, in <module>
main()
File \"/tmp/ansible_2inxygge/ansible_module_apt.py\", line 998, in main
upgrade(module, 'yes', force_yes, p['default_release'], use_apt_get, dpkg_options)
File \"/tmp/ansible_2inxygge/ansible_module_apt.py\", line 759, in upgrade
apt_cmd_path = m.get_bin_path(apt_cmd, required=True)
File \"/tmp/ansible_2inxygge/ansible_modlib.zip/ansible/module_utils/basic.py\", line 2182, in get_bin_path
File \"/usr/lib/python3.5/posixpath.py\", line 89, in join
genericpath._check_arg_types('join', a, *p)
File \"/usr/lib/python3.5/genericpath.py\", line 143, in _check_arg_types
(funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'
It seems that since aptitude is not installed on Xenial, so APTITUDE_CMD is None
and we later hit the bug in the upgrade function since it assume APTITUDE_CMD
is set.
Trying to use the apt module on a freshly install 16.04 Ubuntu VM with
"ansible -m apt -a 'name=* state=latest' all" fail with this backtrace:
It seems that since aptitude is not installed on Xenial, so APTITUDE_CMD is None
and we later hit the bug in the upgrade function since it assume APTITUDE_CMD
is set.
SUMMARY
ISSUE TYPE
COMPONENT NAME
apt