Skip to content

Commit

Permalink
coses
Browse files Browse the repository at this point in the history
  • Loading branch information
jordiprats committed Mar 30, 2020
1 parent 85af167 commit 1e0487c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/facter/eypconf_generic_id.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 1e0487c

Please sign in to comment.