summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElan Ruusamäe <glen@delfi.ee>2016-05-31 23:59:06 +0300
committerElan Ruusamäe <glen@delfi.ee>2016-05-31 23:59:06 +0300
commit54f9ee740743dc452b6ef0921df973643b973d59 (patch)
treeefc34af6f11b68d3f2e2a6b992fc9fb391a8be7b
parent8a602446bd9067a4b541d9d146bbb4ade77f1a5d (diff)
downloadohai-54f9ee740743dc452b6ef0921df973643b973d59.tar.gz
unify debian/rpm style
-rw-r--r--lib/ohai/plugins/packages.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ohai/plugins/packages.rb b/lib/ohai/plugins/packages.rb
index 5f48327b..bd0df1f1 100644
--- a/lib/ohai/plugins/packages.rb
+++ b/lib/ohai/plugins/packages.rb
@@ -31,7 +31,8 @@ Ohai.plugin(:Packages) do
collect_data(:linux) do
packages Mash.new
if %w{debian}.include? platform_family
- so = shell_out("dpkg-query -W -f='${Package}\t${Version}\t${Architecture}\n'")
+ format = '${Package}\t${Version}\t${Architecture}\n'
+ so = shell_out("dpkg-query -W -f='#{format}'")
pkgs = so.stdout.lines
pkgs.each do |pkg|
@@ -40,9 +41,8 @@ Ohai.plugin(:Packages) do
end
elsif %w{rhel fedora suse pld}.include? platform_family
- require "shellwords"
- format = Shellwords.escape '%{NAME}\t%|EPOCH?{%{EPOCH}}:{0}|\t%{VERSION}\t%{RELEASE}\t%{INSTALLTIME}\t%{ARCH}\n'
- so = shell_out("rpm -qa --queryformat #{format}")
+ format = '%{NAME}\t%|EPOCH?{%{EPOCH}}:{0}|\t%{VERSION}\t%{RELEASE}\t%{INSTALLTIME}\t%{ARCH}\n'
+ so = shell_out("rpm -qa --qf '#{format}'")
pkgs = so.stdout.lines
pkgs.each do |pkg|