File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
lib/octocatalog-diff/facts Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,18 @@ def self.fact_retriever(options = {}, node = '')
21
21
fact_file_data = fact_file_string . split ( /\n / )
22
22
fact_file_data [ 0 ] = '---' if fact_file_data [ 0 ] =~ /^---/
23
23
24
- # Load and return the parsed fact file.
25
- result = YAML . load ( fact_file_data . join ( "\n " ) )
24
+ # Load the parsed fact file.
25
+ parsed = YAML . load ( fact_file_data . join ( "\n " ) )
26
+
27
+ # This is a handler for a YAML file that has just the facts and none of the
28
+ # structure. For example if you saved the output of `facter -y` to a file and
29
+ # are passing that in, this will work.
30
+ result = if parsed . key? ( 'name' ) && parsed . key? ( 'values' )
31
+ parsed
32
+ else
33
+ { 'name' => node || parsed [ 'fqdn' ] || '' , 'values' => parsed }
34
+ end
35
+
26
36
result [ 'name' ] = node unless node == ''
27
37
result
28
38
end
You can’t perform that action at this time.
0 commit comments