mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Implement compatible 'info_installed'. Returned keys are common to other systems with other package managers
This commit is contained in:
parent
f14f4036df
commit
c1faebf0b5
@ -2217,3 +2217,35 @@ def owner(*paths):
|
||||
if len(ret) == 1:
|
||||
return next(six.itervalues(ret))
|
||||
return ret
|
||||
|
||||
|
||||
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 == 'package':
|
||||
t_nfo['name'] = value
|
||||
elif key == 'origin':
|
||||
t_nfo['vendor'] = value
|
||||
elif key == 'section':
|
||||
t_nfo['group'] = value
|
||||
elif key == 'maintainer':
|
||||
t_nfo['packager'] = value
|
||||
else:
|
||||
t_nfo[key] = value
|
||||
|
||||
ret[pkg_name] = t_nfo
|
||||
|
||||
return ret
|
||||
|
Loading…
Reference in New Issue
Block a user