Implement compatible 'info_installed'. Returned keys are common to other systems with other package managers

This commit is contained in:
Bo Maryniuk 2015-09-09 17:50:53 +02:00
parent c1faebf0b5
commit ca7d0d5025

View file

@ -684,6 +684,32 @@ def list_upgrades(refresh=True, **kwargs):
return dict([(x.name, x.version) for x in updates])
def info_installed(*names):
'''
Return the information of the named package(s), installed on the system.
CLI example:
.. code-block:: bash
salt '*' pkg.info_installed <package1>
salt '*' pkg.info_installed <package1> <package2> <package3> ...
'''
ret = dict()
for pkg_name, pkg_nfo in __salt__['lowpkg.info'](*names).items():
t_nfo = dict()
# Translate dpkg-specific keys to a common structure
for key, value in pkg_nfo.items():
if key == 'source_rpm':
t_nfo['source'] = value
else:
t_nfo[key] = value
ret[pkg_name] = t_nfo
return ret
def check_db(*names, **kwargs):
'''
.. versionadded:: 0.17.0