community.general/lib/ansible/modules/packaging/os
Michael Scherer 2734895c48 Do switch to apt if aptitude is not installed (#30738)
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.
2018-12-18 12:48:11 -05:00
..
__init__.py
apk.py
apt.py
apt_key.py
apt_repo.py
apt_repository.py
apt_rpm.py
dnf.py
dpkg_selections.py
flatpak.py
flatpak_remote.py
homebrew.py
homebrew_cask.py
homebrew_tap.py
layman.py
macports.py
openbsd_pkg.py
opkg.py
package.py
package_facts.py
pacman.py
pkg5.py
pkg5_publisher.py
pkgin.py
pkgng.py
pkgutil.py
portage.py
portinstall.py
pulp_repo.py
redhat_subscription.py
rhn_channel.py
rhn_register.py
rhsm_repository.py
rhsm_repository_release.py
rpm_key.py
slackpkg.py
snap.py
sorcery.py
svr4pkg.py
swdepot.py
swupd.py
urpmi.py
xbps.py
yum.py
yum_repository.py
zypper.py
zypper_repository.py