Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Won't Do
-
FACT 2.3.0
-
None
-
None
-
None
Description
Text-based external facts can be created by adding a file to a module's facts.d/ directory. Indeed, thanks to another bug, at least one fact must exist (or an error is generated). It becomes sensible to create a "null" fact. However, the text-based parser does not allow this.
module KeyValuePairOutputFormat |
def self.parse(output) |
return {} if output.nil? |
|
result = {}
|
re = /^(.+?)=(.+)$/
|
output.each_line do |line| |
if match_data = re.match(line.chomp) |
result[match_data[1]] = match_data[2] |
end |
end |
result
|
end |
end |
A different re would fix this:
re = /^(.+?)=(.*)$/
|