now catches lock exceptoins on apt and returns friendly message instead of
traceback Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
This commit is contained in:
parent
fdee719d79
commit
d3f6071d66
1 changed files with 34 additions and 30 deletions
4
apt
4
apt
|
@ -226,6 +226,7 @@ def main():
|
|||
p = module.params
|
||||
install_recommends = p['install_recommends']
|
||||
|
||||
try:
|
||||
cache = apt.Cache()
|
||||
if p['default_release']:
|
||||
apt_pkg.config['APT::Default-Release'] = p['default_release']
|
||||
|
@ -262,6 +263,9 @@ def main():
|
|||
elif p['state'] in [ 'removed', 'absent' ]:
|
||||
remove(module, packages, cache, p['purge'])
|
||||
|
||||
except LockFailedException:
|
||||
module.fail_json(msg="Failed to lock apt for exclusive operation")
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
||||
|
||||
|
|
Loading…
Reference in a new issue