@ -460,7 +460,7 @@ def main():
# get supported pkg managers
# get supported pkg managers
PKG_MANAGERS = get_all_pkg_managers ( )
PKG_MANAGERS = get_all_pkg_managers ( )
PKG_MANAGER_NAMES = [ x . lower ( ) for x in PKG_MANAGERS . keys ( ) ]
PKG_MANAGER_NAMES = sorted ( [ x . lower ( ) for x in PKG_MANAGERS . keys ( ) ] )
# add aliases
# add aliases
PKG_MANAGER_NAMES . extend ( [ alias for alist in ALIASES . values ( ) for alias in alist ] )
PKG_MANAGER_NAMES . extend ( [ alias for alist in ALIASES . values ( ) for alias in alist ] )
@ -510,12 +510,24 @@ def main():
manager = PKG_MANAGERS [ pkgmgr ] ( )
manager = PKG_MANAGERS [ pkgmgr ] ( )
try :
try :
packages_found = { }
if manager . is_available ( handle_exceptions = False ) :
if manager . is_available ( handle_exceptions = False ) :
found + = 1
try :
try :
packages . update ( manager . get_packages ( ) )
packages _found = manager . get_packages ( )
except Exception as e :
except Exception as e :
module . warn ( ' Failed to retrieve packages with %s : %s ' % ( pkgmgr , to_text ( e ) ) )
module . warn ( ' Failed to retrieve packages with %s : %s ' % ( pkgmgr , to_text ( e ) ) )
# only consider 'found' if it results in something
if packages_found :
found + = 1
for k in packages_found . keys ( ) :
if k in packages :
packages [ k ] . extend ( packages_found [ k ] )
else :
packages [ k ] = packages_found [ k ]
else :
module . warn ( ' Found " %s " but no associated packages ' % ( pkgmgr ) )
except Exception as e :
except Exception as e :
if pkgmgr in module . params [ ' manager ' ] :
if pkgmgr in module . params [ ' manager ' ] :
module . warn ( ' Requested package manager %s was not usable by this module: %s ' % ( pkgmgr , to_text ( e ) ) )
module . warn ( ' Requested package manager %s was not usable by this module: %s ' % ( pkgmgr , to_text ( e ) ) )