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:52:22 +02:00
parent ca7d0d5025
commit 7b376fd5c3

View file

@ -96,6 +96,30 @@ list_updates = list_upgrades
def info(*names, **kwargs):
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
'''
Return the information of the named package available for the system.