Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jordiprats/eyp-eyplib
Browse files Browse the repository at this point in the history
  • Loading branch information
jordiprats committed Mar 30, 2020
2 parents 2f1ff64 + c165512 commit 7311df2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 0.1.22

* added **eypconf_location**
* added **eypconf_sg** fact (servergroup shortname)

## 0.1.21

Expand Down
25 changes: 25 additions & 0 deletions lib/facter/eypconf_sg.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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

0 comments on commit 7311df2

Please sign in to comment.