mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Only use LONGSIZE in rpm.info if available. Otherwise, use SIZE.
Fixes #31366
This commit is contained in:
parent
e553f18dc4
commit
294371243d
@ -422,6 +422,14 @@ def info(*packages, **attr):
|
||||
salt '*' lowpkg.info apache2 bash attr=version
|
||||
salt '*' lowpkg.info apache2 bash attr=version,build_date_iso,size
|
||||
'''
|
||||
# LONGSIZE is not a valid tag for all versions of rpm. If LONGSIZE isn't
|
||||
# available, then we can just use SIZE for older versions. See Issue #31366.
|
||||
rpm_tags = __salt__['cmd.run_all']('rpm --querytags')
|
||||
rpm_tags = rpm_tags.get('stdout').split('\n')
|
||||
if 'LONGSIZE' in rpm_tags:
|
||||
size_tag = '%{LONGSIZE}'
|
||||
else:
|
||||
size_tag = '%{SIZE}'
|
||||
|
||||
cmd = packages and "rpm -q {0}".format(' '.join(packages)) or "rpm -qa"
|
||||
|
||||
@ -440,7 +448,7 @@ def info(*packages, **attr):
|
||||
"build_host": "build_host: %{BUILDHOST}\\n",
|
||||
"group": "group: %{GROUP}\\n",
|
||||
"source_rpm": "source_rpm: %{SOURCERPM}\\n",
|
||||
"size": "size: %{LONGSIZE}\\n",
|
||||
"size": "size: " + size_tag + "\\n",
|
||||
"arch": "arch: %{ARCH}\\n",
|
||||
"license": "%|LICENSE?{license: %{LICENSE}\\n}|",
|
||||
"signature": "signature: %|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:"
|
||||
|
Loading…
Reference in New Issue
Block a user