From 1e0487c089e70b0e295728472c63bf37dd232079 Mon Sep 17 00:00:00 2001 From: Jordi Prats Date: Mon, 30 Mar 2020 16:32:35 +0200 Subject: [PATCH] coses --- lib/facter/eypconf_generic_id.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/facter/eypconf_generic_id.rb b/lib/facter/eypconf_generic_id.rb index 4cffb8d..1c77b71 100644 --- a/lib/facter/eypconf_generic_id.rb +++ b/lib/facter/eypconf_generic_id.rb @@ -1,27 +1,33 @@ Dir.entries("/etc/eypconf/id").select {|f| !File.directory? f}.each do |i| - genetic_id = Facter::Util::Resolution.exec("bash -c 'cat /etc/eypconf/id/#{i}'").to_s + if i[0]=='.' + fact_name=i[1..-1] + genetic_id = Facter::Util::Resolution.exec("bash -c 'cat /etc/eypconf/id/#{fact_name}'").to_s + else + fact_name=i + genetic_id = Facter::Util::Resolution.exec("bash -c 'cat /etc/eypconf/id/#{fact_name}'").to_s + end unless genetic_id.nil? or genetic_id.empty? - Facter.add("eypconf_#{i}") do + Facter.add("eypconf_#{fact_name}") do setcode do genetic_id end end - Facter.add("eypconf_#{i}|_uppercase") do + Facter.add("eypconf_#{fact_name}|_uppercase") do setcode do genetic_id.upcase end end - Facter.add("eypconf_#{i}_lowercase") do + Facter.add("eypconf_#{fact_name}_lowercase") do setcode do genetic_id.downcase end end - Facter.add("eypconf_#{i}_source") do + Facter.add("eypconf_#{fact_name}_source") do setcode do i end