Skip to content

Commit

Permalink
Merge pull request #29 from jordiprats/master
Browse files Browse the repository at this point in the history
facts eyplib
  • Loading branch information
jordiprats authored Mar 24, 2020
2 parents 1dfc8a2 + c165512 commit 334a7b6
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 0.1.22

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

## 0.1.21

* added double empty line at the end of the autobanner file
Expand Down
14 changes: 14 additions & 0 deletions lib/facter/eypconf_location.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
if File.exists?('/opt/eypconf/id/description.sh') then
description = Facter::Util::Resolution.exec('bash /opt/eypconf/id/description.sh').to_s
else
description = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/description ]; then cat /opt/eypconf/id/description | paste -sd,; fi\'').to_s
end

unless description.nil? or description.empty?
Facter.add('eypconf_description') do
setcode do
description
end
end

end
File renamed without changes.
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
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eyp-eyplib",
"version": "0.1.21",
"version": "0.1.22",
"author": "eyp",
"summary": "Utility functions for puppet modules",
"license": "Apache-2.0",
Expand Down

0 comments on commit 334a7b6

Please sign in to comment.