Skip to content

Commit

Permalink
Merge pull request #13 from jordiprats/master
Browse files Browse the repository at this point in the history
fact projectid
  • Loading branch information
jordiprats authored Mar 19, 2018
2 parents 24acca4 + d7729c9 commit db8876d
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 db8876d

Please sign in to comment.