summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Justice <jjustice6@bloomberg.net>2019-06-04 12:03:52 -0400
committerJoshua Justice <jjustice6@bloomberg.net>2019-07-10 15:28:38 -0400
commit510cd478e3862e19be299dd3c743fbcca9a8719b (patch)
tree49ee6dc17c5060552638e522de4b73d50ad12b3c
parent0736be5bfe26792d48d3905144920cd28899da82 (diff)
downloadohai-510cd478e3862e19be299dd3c743fbcca9a8719b.tar.gz
Clean up array initialization
Signed-off-by: Joshua Justice <jjustice6@bloomberg.net>
-rw-r--r--lib/ohai/plugins/packages.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ohai/plugins/packages.rb b/lib/ohai/plugins/packages.rb
index a7a74f7d..7f13dd32 100644
--- a/lib/ohai/plugins/packages.rb
+++ b/lib/ohai/plugins/packages.rb
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
# Author:: "Christian Höltje" <choltje@us.ibm.com>
# Author:: "Christopher M. Luciano" <cmlucian@us.ibm.com>
# Author:: Shahul Khajamohideen (<skhajamohid1@bloomberg.net>)
@@ -53,7 +54,7 @@ Ohai.plugin(:Packages) do
# Create an "other_versions" array for tracking all versions of packages with this name.
# The top-level package information will be the first one returned by rpm -qa,
# all others go in this list, with the same information they'd normally have.
- packages[name]["other_versions"] = [] unless packages[name]["other_versions"]
+ packages[name]["other_versions"] ||= []
packages[name]["other_versions"] << Mash.new({ "epoch" => epoch, "version" => version, "release" => release, "installdate" => installdate, "arch" => arch })
else
packages[name] = { "epoch" => epoch, "version" => version, "release" => release, "installdate" => installdate, "arch" => arch }