mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Properly catch import errors in apt
When one accidentally tries to run this module as a user, he gets the error message that python-apt must be installed, no matter what. Because importing apt will trigger an exception as a regular user. Explicitly catching the ImportError will let the exception bubble. The exception clearly says Permission denied somewhere, and the user has a better idea, what he must fix.
This commit is contained in:
parent
47bfa8b9eb
commit
38d6956c1f
1 changed files with 1 additions and 1 deletions
|
@ -153,7 +153,7 @@ HAS_PYTHON_APT = True
|
|||
try:
|
||||
import apt
|
||||
import apt_pkg
|
||||
except:
|
||||
except ImportError:
|
||||
HAS_PYTHON_APT = False
|
||||
|
||||
def package_split(pkgspec):
|
||||
|
|
Loading…
Reference in a new issue