diff options
Diffstat (limited to 'lib/ohai/plugins/rpm.rb')
-rw-r--r-- | lib/ohai/plugins/rpm.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/ohai/plugins/rpm.rb b/lib/ohai/plugins/rpm.rb index 7f4870b1..c131ad50 100644 --- a/lib/ohai/plugins/rpm.rb +++ b/lib/ohai/plugins/rpm.rb @@ -91,17 +91,27 @@ Ohai.plugin(:Rpm) do value = "" lines[macros_start_idx + 1..macros_end_idx - 1].each do |line| if line.start_with?("-") + # new macros are always prefixed by a dash if name + # if we had parsed a macro before, store it rpm[:macros][name] = value name = nil value = "" - else - _prefix, name, value = line.split(" ", 3) end + + # parse the new macro definition + _prefix, name, value = line.split(" ", 3) else + # continuations have no prefix and just append to the previous one value += "\n#{line}" end end + + # Once we're done parsing all lines, we might have a parsed definition + # we haven't stored - if so, store it. + if name + rpm[:macros][name] = value + end else logger.trace("Plugin RPM: Could not find rpm. Skipping plugin.") end |