mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Use salt.utils.winapi.Com instead of manually
This commit is contained in:
parent
fa787918c8
commit
2e942c821c
@ -119,17 +119,16 @@ def list_pkgs(*args):
|
||||
|
||||
salt '*' pkg.list_pkgs
|
||||
'''
|
||||
pythoncom.CoInitialize()
|
||||
if len(args) == 0:
|
||||
pkgs = dict(
|
||||
list(_get_reg_software().items()) +
|
||||
list(_get_msi_software().items()))
|
||||
else:
|
||||
# get package version for each package in *args
|
||||
pkgs = {}
|
||||
for arg in args:
|
||||
pkgs.update(_search_software(arg))
|
||||
pythoncom.CoUninitialize()
|
||||
with salt.utils.winapi.Com():
|
||||
if len(args) == 0:
|
||||
pkgs = dict(
|
||||
list(_get_reg_software().items()) +
|
||||
list(_get_msi_software().items()))
|
||||
else:
|
||||
# get package version for each package in *args
|
||||
pkgs = {}
|
||||
for arg in args:
|
||||
pkgs.update(_search_software(arg))
|
||||
return pkgs
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user