diff --git a/CHANGELOG.md b/CHANGELOG.md index b023eca..f42bf8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 0.1.23 + +* simplified **eypconf** fact generation + ## 0.1.22 * added **eypconf_location** diff --git a/lib/facter/eypconf_customer.rb b/lib/facter/eypconf_customer.rb deleted file mode 100644 index 6b4a01e..0000000 --- a/lib/facter/eypconf_customer.rb +++ /dev/null @@ -1,25 +0,0 @@ -if File.exists?('/opt/eypconf/id/customer.sh') then - customer = Facter::Util::Resolution.exec('bash /opt/eypconf/id/customer.sh').to_s -else - customer = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/customer ]; then cat /opt/eypconf/id/customer | paste -sd,; fi\'').to_s -end - -unless customer.nil? or customer.empty? - Facter.add('eypconf_customer') do - setcode do - customer - end - end - - Facter.add('eypconf_customer_uppercase') do - setcode do - customer.upcase - end - end - - Facter.add('eypconf_customer_lowercase') do - setcode do - customer.downcase - end - end -end diff --git a/lib/facter/eypconf_description.rb b/lib/facter/eypconf_description.rb deleted file mode 100644 index a2a5fab..0000000 --- a/lib/facter/eypconf_description.rb +++ /dev/null @@ -1,14 +0,0 @@ -if File.exists?('/opt/eypconf/id/description.sh') then - description = Facter::Util::Resolution.exec('bash /opt/eypconf/id/description.sh').to_s -else - description = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/description ]; then cat /opt/eypconf/id/description | paste -sd,; fi\'').to_s -end - -unless description.nil? or description.empty? - Facter.add('eypconf_description') do - setcode do - description - end - end - -end diff --git a/lib/facter/eypconf_env.rb b/lib/facter/eypconf_env.rb deleted file mode 100644 index 318365c..0000000 --- a/lib/facter/eypconf_env.rb +++ /dev/null @@ -1,26 +0,0 @@ -if File.exists?('/opt/eypconf/id/env.sh') then - env = Facter::Util::Resolution.exec('bash /opt/eypconf/id/env.sh').to_s -else - env = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/env ]; then cat /opt/eypconf/id/env | paste -sd,; fi\'').to_s -end - -unless env.nil? or env.empty? - Facter.add('eypconf_env') do - setcode do - env - end - end - - Facter.add('eypconf_env_uppercase') do - setcode do - env.upcase - end - end - - Facter.add('eypconf_env_lowercase') do - setcode do - env.downcase - end - end - -end diff --git a/lib/facter/eypconf_generic_id.rb b/lib/facter/eypconf_generic_id.rb index 3b4da30..7b17528 100644 --- a/lib/facter/eypconf_generic_id.rb +++ b/lib/facter/eypconf_generic_id.rb @@ -1,6 +1,6 @@ -Dir.entries("/etc/eypconf/id").select {|f| !File.directory? f}.each do |i| +Dir.entries("/opt/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 + genetic_id = Facter::Util::Resolution.exec("bash -c 'cat /opt/eypconf/id/#{i}'").to_s if i[0]=='.' fact_name=i[1..-1] @@ -15,7 +15,7 @@ end end - Facter.add("eypconf_#{fact_name}|_uppercase") do + Facter.add("eypconf_#{fact_name}_uppercase") do setcode do genetic_id.upcase end diff --git a/lib/facter/eypconf_location.rb b/lib/facter/eypconf_location.rb deleted file mode 100644 index a2a5fab..0000000 --- a/lib/facter/eypconf_location.rb +++ /dev/null @@ -1,14 +0,0 @@ -if File.exists?('/opt/eypconf/id/description.sh') then - description = Facter::Util::Resolution.exec('bash /opt/eypconf/id/description.sh').to_s -else - description = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/description ]; then cat /opt/eypconf/id/description | paste -sd,; fi\'').to_s -end - -unless description.nil? or description.empty? - Facter.add('eypconf_description') do - setcode do - description - end - end - -end diff --git a/lib/facter/eypconf_magic_hash.rb b/lib/facter/eypconf_magic_hash.rb deleted file mode 100644 index 6935bc0..0000000 --- a/lib/facter/eypconf_magic_hash.rb +++ /dev/null @@ -1,13 +0,0 @@ -if File.exists?('/opt/eypconf/id/magic.sh') then - magichash = Facter::Util::Resolution.exec('bash /opt/eypconf/id/magic.sh').to_s -else - magichash = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/.magic ]; then cat /opt/eypconf/id/.magic | paste -sd,; else echo "deadbeef"; fi\'').to_s -end - -unless magichash.nil? or magichash.empty? - Facter.add('eypconf_magic_hash') do - setcode do - magichash - end - end -end diff --git a/lib/facter/eypconf_platformid.rb b/lib/facter/eypconf_platformid.rb deleted file mode 100644 index d482da7..0000000 --- a/lib/facter/eypconf_platformid.rb +++ /dev/null @@ -1,25 +0,0 @@ -if File.exists?('/opt/eypconf/id/platformid.sh') then - platformid = Facter::Util::Resolution.exec('bash /opt/eypconf/id/platformid.sh').to_s -else - platformid = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/platformid ]; then cat /opt/eypconf/id/platformid | paste -sd,; fi\'').to_s -end - -unless platformid.nil? or platformid.empty? - Facter.add('eypconf_platformid') do - setcode do - platformid - end - end - - Facter.add('eypconf_platformid_uppercase') do - setcode do - platformid.upcase - end - end - - Facter.add('eypconf_platformid_lowercase') do - setcode do - platformid.downcase - end - end -end diff --git a/lib/facter/eypconf_servergroup.rb b/lib/facter/eypconf_servergroup.rb deleted file mode 100644 index c43148e..0000000 --- a/lib/facter/eypconf_servergroup.rb +++ /dev/null @@ -1,25 +0,0 @@ -if File.exists?('/opt/eypconf/id/servergroup.sh') then - servergroup = Facter::Util::Resolution.exec('bash /opt/eypconf/id/servergroup.sh').to_s -else - servergroup = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/servergroup ]; then cat /opt/eypconf/id/server; fi\'') -end - -unless servergroup.nil? or servergroup.empty? - Facter.add('eypconf_servergroup') do - setcode do - servergroup - end - end - - Facter.add('eypconf_servergroup_uppercase') do - setcode do - servergroup.upcase - end - end - - Facter.add('eypconf_servergroup_lowercase') do - setcode do - servergroup.downcase - end - end -end diff --git a/lib/facter/eypconf_sg.rb b/lib/facter/eypconf_sg.rb deleted file mode 100644 index 14776bb..0000000 --- a/lib/facter/eypconf_sg.rb +++ /dev/null @@ -1,25 +0,0 @@ -if File.exists?('/opt/eypconf/id/sg.sh') then - sg = Facter::Util::Resolution.exec('bash /opt/eypconf/id/sg.sh').to_s -else - sg = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/sg ]; then cat /opt/eypconf/id/server; fi\'') -end - -unless sg.nil? or sg.empty? - Facter.add('eypconf_sg') do - setcode do - sg - end - end - - Facter.add('eypconf_sg_uppercase') do - setcode do - sg.upcase - end - end - - Facter.add('eypconf_sg_lowercase') do - setcode do - sg.downcase - end - end -end diff --git a/lib/facter/eypconf_type.rb b/lib/facter/eypconf_type.rb deleted file mode 100644 index a25997f..0000000 --- a/lib/facter/eypconf_type.rb +++ /dev/null @@ -1,25 +0,0 @@ -if File.exists?('/opt/eypconf/id/type.sh') then - nodetype = Facter::Util::Resolution.exec('bash /opt/eypconf/id/type.sh').to_s -else - nodetype = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/type ]; then cat /opt/eypconf/id/type | paste -sd,; fi\'') -end - -unless nodetype.nil? or nodetype.empty? - Facter.add('eypconf_type') do - setcode do - nodetype - end - end - - Facter.add('eypconf_type_uppercase') do - setcode do - nodetype.upcase - end - end - - Facter.add('eypconf_type_lowercase') do - setcode do - nodetype.downcase - end - end -end diff --git a/lib/facter/eypconf_userid.rb b/lib/facter/eypconf_userid.rb deleted file mode 100644 index 97c3e71..0000000 --- a/lib/facter/eypconf_userid.rb +++ /dev/null @@ -1,25 +0,0 @@ -if File.exists?('/opt/eypconf/id/userid.sh') then - userid = Facter::Util::Resolution.exec('bash /opt/eypconf/id/userid.sh').to_s -else - userid = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/userid ]; then cat /opt/eypconf/id/userid | paste -sd,; fi\'').to_s -end - -unless userid.nil? or userid.empty? - Facter.add('eypconf_userid') do - setcode do - userid - end - end - - Facter.add('eypconf_userid_uppercase') do - setcode do - userid.upcase - end - end - - Facter.add('eypconf_userid_lowercase') do - setcode do - userid.downcase - end - end -end diff --git a/metadata.json b/metadata.json index 90af06a..fbba535 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "eyp-eyplib", - "version": "0.1.22", + "version": "0.1.23", "author": "eyp", "summary": "Utility functions for puppet modules", "license": "Apache-2.0",