mirror of
https://github.com/inspec/inspec
synced 2024-11-14 17:07:09 +00:00
convert single entry arrays to strings
This commit is contained in:
parent
fc811518e8
commit
3559ba4aeb
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue