Use salt.utils.winapi.Com instead of manually

This commit is contained in:
David Boucha 2013-02-18 16:50:22 -07:00
parent fa787918c8
commit 2e942c821c

View File

@ -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