apt: autoinstall python-apt if not available
This commit is contained in:
parent
2b20be94e0
commit
c2c0729f6e
1 changed files with 7 additions and 1 deletions
|
@ -322,7 +322,13 @@ def main():
|
|||
)
|
||||
|
||||
if not HAS_PYTHON_APT:
|
||||
module.fail_json(msg="Could not import python modules: apt, apt_pkg. Please install python-apt package.")
|
||||
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.")
|
||||
|
||||
global APTITUDE_CMD
|
||||
APTITUDE_CMD = module.get_bin_path("aptitude", False)
|
||||
|
|
Loading…
Reference in a new issue