diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c48d85..eadd7c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,11 @@ ## 0.1.10 -* added **eypconf_group** fact +* added **eypconf_servergroup** fact ## 0.1.9 -* removed bool2httpd function +* removed **bool2httpd** function ## 0.1.8 diff --git a/lib/facter/eypconf_group.rb b/lib/facter/eypconf_group.rb deleted file mode 100644 index 932a634..0000000 --- a/lib/facter/eypconf_group.rb +++ /dev/null @@ -1,25 +0,0 @@ -if File.exists?('/opt/eypconf/id/group.sh') then - nodetype = Facter::Util::Resolution.exec('bash /opt/eypconf/id/group.sh').to_s -else - nodetype = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/group ]; then cat /opt/eypconf/id/type | paste -sd,; fi\'') -end - -unless nodetype.nil? or nodetype.empty? - Facter.add('eypconf_group') do - setcode do - nodetype - end - end - - Facter.add('eypconf_group_uppercase') do - setcode do - nodetype.upcase - end - end - - Facter.add('eypconf_group_lowercase') do - setcode do - nodetype.downcase - end - end -end diff --git a/lib/facter/eypconf_servergroup.rb b/lib/facter/eypconf_servergroup.rb new file mode 100644 index 0000000..c43148e --- /dev/null +++ b/lib/facter/eypconf_servergroup.rb @@ -0,0 +1,25 @@ +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