Skip to content

Commit

Permalink
fact projectid
Browse files Browse the repository at this point in the history
  • Loading branch information
jordiprats committed Mar 19, 2018
1 parent 99ee200 commit d7729c9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.1.13

* added **eypconf_projectid**

## 0.1.12

* added **yesno2bool** function
Expand Down
25 changes: 25 additions & 0 deletions lib/facter/eypconf_projectid.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d7729c9

Please sign in to comment.