diff --git a/deployment/puppet/nailgun/lib/facter/fuel_version.rb b/deployment/puppet/nailgun/lib/facter/fuel_version.rb index d31f67688c..b7701f53bb 100644 --- a/deployment/puppet/nailgun/lib/facter/fuel_version.rb +++ b/deployment/puppet/nailgun/lib/facter/fuel_version.rb @@ -1,11 +1,14 @@ require 'facter' -fuel_version_path = '/etc/nailgun/version.yaml' +fuel_version_path = [ '/etc/fuel/version.yaml', '/etc/fuel/nailgun/version.yaml', '/etc/nailgun/version.yaml' ] +read_data = "none" Facter.add('fuel_version_yaml') do - if File.exist?(fuel_version_path) - setcode { File.read(fuel_version_path) } - else - setcode { "none" } + fuel_version_path.each do |fuel_version_file| + if File.exist?(fuel_version_file) + read_data = File.read(fuel_version_file) + break + end end + setcode { read_data } end diff --git a/deployment/puppet/nailgun/lib/facter/generate_fuel_key.rb b/deployment/puppet/nailgun/lib/facter/generate_fuel_key.rb index 608075016c..409b257656 100644 --- a/deployment/puppet/nailgun/lib/facter/generate_fuel_key.rb +++ b/deployment/puppet/nailgun/lib/facter/generate_fuel_key.rb @@ -1,9 +1,11 @@ -Facter.add("generate_fuel_key") do - setcode do - begin - File.read('/etc/fuel-uuid').chomp - rescue - nil +require 'facter' +fuel_uuid_path = [ '/etc/fuel/fuel-uuid', '/etc/fuel-uuid' ] + +fuel_uuid_path.each do |uuid_file| + if File.exist?(uuid_file) + Facter.add('generate_fuel_key') do + setcode { File.read(uuid_file).chomp } end + break end end diff --git a/deployment/puppet/osnailyfacter/lib/facter/naily.rb b/deployment/puppet/osnailyfacter/lib/facter/naily.rb index 6758c21017..4b4636b303 100644 --- a/deployment/puppet/osnailyfacter/lib/facter/naily.rb +++ b/deployment/puppet/osnailyfacter/lib/facter/naily.rb @@ -1,14 +1,13 @@ require 'facter' # This file is created and managed by Astute +astute_settings_path = ['/etc/fuel/astute.yaml', '/etc/astute.yaml'] -Facter.add('astute_settings_yaml') do - setcode do - astute_settings_path = '/etc/astute.yaml' - if File.readable? astute_settings_path - File.read astute_settings_path - else - nil +astute_settings_path.each do |astute_file| + if File.exist?(astute_file) + Facter.add('astute_settings_yaml') do + setcode { File.read(astute_file) } end + break end end