From 3559ba4aeb2ea1a1e3edfa7f382689bccf1e5d83 Mon Sep 17 00:00:00 2001 From: Thomas Cate Date: Fri, 18 Dec 2015 08:38:48 -0600 Subject: [PATCH] convert single entry arrays to strings --- lib/resources/grub_conf.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/resources/grub_conf.rb b/lib/resources/grub_conf.rb index abd6d091a..e61643082 100644 --- a/lib/resources/grub_conf.rb +++ b/lib/resources/grub_conf.rb @@ -45,6 +45,7 @@ class GrubConfig < Inspec.resource(1) return @params = {} end + # Find all "title" lines and then parse them into arrays lines = content.split("\n") kernel_opts = {} lines.each_with_index do |file_line,index| @@ -70,6 +71,14 @@ class GrubConfig < Inspec.resource(1) content, multiple_values: true, ).params + + # convert single entry arrays into strings + conf.each do |key, value| + if (value.size == 1) + conf[key] = conf[key][0].to_s + end + end + @params = conf.merge(kernel_opts) end end