mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Implement compatible 'info_installed'. Returned keys are common to other systems with other package managers
This commit is contained in:
parent
c1faebf0b5
commit
ca7d0d5025
1 changed files with 26 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue