remove pkg arch from list_pkgs output

This commit is contained in:
Erik Johnson 2012-12-09 22:34:13 -06:00
parent 32b476594a
commit f222cc02ad
2 changed files with 4 additions and 8 deletions

View File

@ -209,15 +209,13 @@ def list_pkgs(*args):
salt '*' pkg.list_pkgs
'''
cmd = 'rpm -qa --queryformat ' \
'"%{NAME}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}\n"'
cmd = 'rpm -qa --queryformat "%{NAME}_|-%{VERSION}_|-%{RELEASE}\n"'
ret = {}
for line in __salt__['cmd.run'](cmd).splitlines():
name, version, rel, arch = line.split('_|-')
name, version, rel = line.split('_|-')
pkgver = version
if rel:
pkgver += '-{0}'.format(rel)
pkgver += '.{0}'.format(arch)
__salt__['pkg_resource.add_pkg'](ret, name, pkgver)
__salt__['pkg_resource.sort_pkglist'](ret)
return ret

View File

@ -109,15 +109,13 @@ def list_pkgs():
salt '*' pkg.list_pkgs
'''
cmd = 'rpm -qa --queryformat ' \
'"%{NAME}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}\n"'
cmd = 'rpm -qa --queryformat "%{NAME}_|-%{VERSION}_|-%{RELEASE}\n"'
ret = {}
for line in __salt__['cmd.run'](cmd).splitlines():
name, version, rel, arch = line.split('_|-')
name, version, rel = line.split('_|-')
pkgver = version
if rel:
pkgver += '-{0}'.format(rel)
pkgver += '.{0}'.format(arch)
__salt__['pkg_resource.add_pkg'](ret, name, pkgver)
__salt__['pkg_resource.sort_pkglist'](ret)
return ret