Merge pull request #4617 from resmo/feature/python-apt
apt: autoinstall python-apt if apt or apt_pkg is not available
This commit is contained in:
commit
f58bbd5913
1 changed files with 7 additions and 1 deletions
|
@ -344,6 +344,12 @@ def main():
|
||||||
)
|
)
|
||||||
|
|
||||||
if not HAS_PYTHON_APT:
|
if not HAS_PYTHON_APT:
|
||||||
|
try:
|
||||||
|
module.run_command('apt-get install python-apt -y -q')
|
||||||
|
global apt, apt_pkg
|
||||||
|
import apt
|
||||||
|
import apt_pkg
|
||||||
|
except:
|
||||||
module.fail_json(msg="Could not import python modules: apt, apt_pkg. Please install python-apt package.")
|
module.fail_json(msg="Could not import python modules: apt, apt_pkg. Please install python-apt package.")
|
||||||
|
|
||||||
global APTITUDE_CMD
|
global APTITUDE_CMD
|
||||||
|
|
Loading…
Reference in a new issue