Skip to content

Commit

Permalink
loop
Browse files Browse the repository at this point in the history
  • Loading branch information
jordiprats committed Mar 30, 2020
1 parent 1e0a6bc commit 11c2352
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions lib/facter/eypconf_generic_id.rb
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
Dir.entries("/opt/eypconf/id").select {|f| !File.directory? f}.each do |i|
if File.exists?('/opt/eypconf/id') then
Dir.entries("/opt/eypconf/id").select {|f| !File.directory? f}.each do |i|

genetic_id = Facter::Util::Resolution.exec("bash -c 'cat /opt/eypconf/id/#{i}'").to_s
genetic_id = Facter::Util::Resolution.exec("bash -c 'cat /opt/eypconf/id/#{i}'").to_s

if i[0]=='.'
fact_name=i[1..-1]
else
fact_name=i
end

unless genetic_id.nil? or genetic_id.empty?
Facter.add("eypconf_#{fact_name}") do
setcode do
genetic_id
end
if i[0]=='.' then
fact_name=i[1..-1]
else
fact_name=i
end

Facter.add("eypconf_#{fact_name}_uppercase") do
setcode do
genetic_id.upcase
end
end
unless genetic_id.nil? or genetic_id.empty?
Facter.add("eypconf_#{fact_name}") do
setcode do
genetic_id
end
end

Facter.add("eypconf_#{fact_name}_lowercase") do
setcode do
genetic_id.downcase
end
end
Facter.add("eypconf_#{fact_name}_uppercase") do
setcode do
genetic_id.upcase
end
end

Facter.add("eypconf_#{fact_name}_source") do
setcode do
i
end
Facter.add("eypconf_#{fact_name}_lowercase") do
setcode do
genetic_id.downcase
end
end

Facter.add("eypconf_#{fact_name}_source") do
setcode do
i
end
end
end
end

end
end

0 comments on commit 11c2352

Please sign in to comment.