Skip to content

Commit

Permalink
Prefer value of :facts to value of :fact_file
Browse files Browse the repository at this point in the history
  • Loading branch information
kpaulisse committed Nov 24, 2017
1 parent 9780baf commit 4860fcc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/octocatalog-diff/catalog-util/builddir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ def install_fact_file(logger, options)
raise ArgumentError, 'Called install_fact_file without node, or with an empty node'
end

facts = if options[:fact_file]
facts = if options[:facts].is_a?(OctocatalogDiff::Facts)
options[:facts].dup
elsif options[:fact_file]
raise Errno::ENOENT, "Fact file #{options[:fact_file]} does not exist" unless File.file?(options[:fact_file])
fact_file_opts = { fact_file_string: File.read(options[:fact_file]) }
fact_file_opts[:backend] = Regexp.last_match(1).to_sym if options[:fact_file] =~ /.*\.(\w+)$/
OctocatalogDiff::Facts.new(fact_file_opts)
elsif options[:facts].is_a?(OctocatalogDiff::Facts)
options[:facts].dup
else
raise ArgumentError, 'No facts passed to "install_fact_file" method'
end
Expand Down

0 comments on commit 4860fcc

Please sign in to comment.