diff --git a/CHANGELOG.md b/CHANGELOG.md index 051f372..95b3ea8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 0.1.13 + +* added **eypconf_projectid** + ## 0.1.12 * added **yesno2bool** function diff --git a/lib/facter/eypconf_projectid.rb b/lib/facter/eypconf_projectid.rb new file mode 100644 index 0000000..25b2003 --- /dev/null +++ b/lib/facter/eypconf_projectid.rb @@ -0,0 +1,25 @@ +if File.exists?('/opt/eypconf/id/projectid.sh') then + userid = Facter::Util::Resolution.exec('bash /opt/eypconf/id/projectid.sh').to_s +else + userid = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/projectid ]; then cat /opt/eypconf/id/projectid | paste -sd,; fi\'').to_s +end + +unless userid.nil? or userid.empty? + Facter.add('eypconf_projectid') do + setcode do + userid + end + end + + Facter.add('eypconf_projectid_uppercase') do + setcode do + userid.upcase + end + end + + Facter.add('eypconf_projectid_lowercase') do + setcode do + userid.downcase + end + end +end