mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Replace option 'i' with an explicit queryformat
Option 'i' uses a predefined queryformat that is not necessarily compatible with the code used to parse it. For example: an exception was being thrown on my CentOS 6.7 machines because the default queryformat was placing multiple keys on a signle line. I have therefore replaced the 'i' option with a hardcoded queryformat to ensure consistancy across all systems.
This commit is contained in:
parent
a2128c8f80
commit
4987530986
1 changed files with 19 additions and 2 deletions
|
@ -426,10 +426,27 @@ def info(*packages):
|
|||
salt '*' lowpkg.info apache2 bash
|
||||
'''
|
||||
|
||||
cmd = packages and "rpm -qi {0}".format(' '.join(packages)) or "rpm -qai"
|
||||
cmd = packages and "rpm -q {0}".format(' '.join(packages)) or "rpm -qa"
|
||||
|
||||
# Locale needs to be en_US instead of C, because RPM otherwise will yank the timezone from the timestamps
|
||||
call = __salt__['cmd.run_all'](cmd + " --queryformat '-----\n'",
|
||||
call = __salt__['cmd.run_all'](cmd + (" --queryformat 'Name: %-27{NAME}\n"
|
||||
"Relocations: %|PREFIXES?{[%{PREFIXES} ]}:{(not relocatable)}|\n"
|
||||
"Version: %-27{VERSION}\n"
|
||||
"Vendor: %{VENDOR}\n"
|
||||
"Release: %-27{RELEASE}\n"
|
||||
"Build Date: %{BUILDTIME:date}\n"
|
||||
"Install Date: %|INSTALLTIME?{%-27{INSTALLTIME:date}}:{(not installed) }|\n"
|
||||
"Build Host: %{BUILDHOST}\n"
|
||||
"Group: %-27{GROUP}\n"
|
||||
"Source RPM: %{SOURCERPM}\n"
|
||||
"Size: %-27{LONGSIZE}\n"
|
||||
"%|LICENSE?{License: %{LICENSE}\n}|"
|
||||
"Signature: %|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}|\n"
|
||||
"%|PACKAGER?{Packager: %{PACKAGER}\n}|"
|
||||
"%|URL?{URL: %{URL}\n}|"
|
||||
"Summary: %{SUMMARY}\n"
|
||||
"Description:\n%{DESCRIPTION}\n"
|
||||
"-----\n'"),
|
||||
output_loglevel='trace', env={'LC_ALL': 'en_US', 'TZ': 'UTC'}, clean_env=True)
|
||||
if call['retcode'] != 0:
|
||||
comment = ''
|
||||
|
|
Loading…
Add table
Reference in a new issue