Skip to content

Commit

Permalink
més facts
Browse files Browse the repository at this point in the history
  • Loading branch information
jordiprats committed Mar 5, 2019
1 parent d13f7bf commit 3417cd7
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 34 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ download { 'salt':

### facts

#### eypconf_userid
#### eypconf_platformid

/opt/eypconf/id/userid.sh /opt/eypconf/id/userid
/opt/eypconf/id/platformid.sh /opt/eypconf/id/platformid

**eypconf_userid_uppercase** and **eypconf_userid_lowercase**
**eypconf_platformid_uppercase** and **eypconf_platformid_lowercase**

#### eypconf_magic_hash

Expand All @@ -80,23 +80,29 @@ download { 'salt':

**eypconf_env_uppercase** and **eypconf_env_lowercase**

#### eypconf_projectid
#### eypconf_type

/opt/eypconf/id/projectid.sh /opt/eypconf/id/projectid
/opt/eypconf/id/type.sh /opt/eypconf/id/type

**eypconf_projectid_uppercase** and **eypconf_projectid_lowercase**
**eypconf_type_uppercase** and **eypconf_type_lowercase**

#### eypconf_servergroup

/opt/eypconf/id/servergroup.sh /opt/eypconf/id/servergroup

**eypconf_servergroup_uppercase** and **eypconf_servergroup_lowercase**

#### eypconf_type
#### eypconf_userid

/opt/eypconf/id/type.sh /opt/eypconf/id/type
/opt/eypconf/id/userid.sh /opt/eypconf/id/userid

**eypconf_type_uppercase** and **eypconf_type_lowercase**
**eypconf_userid_uppercase** and **eypconf_userid_lowercase**

#### eypconf_customer

/opt/eypconf/id/customer.sh /opt/eypconf/id/customer

**eypconf_customer_uppercase** and **eypconf_customer_lowercase**

### types

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

unless customer.nil? or customer.empty?
Facter.add('eypconf_customer') do
setcode do
customer
end
end

Facter.add('eypconf_customer_uppercase') do
setcode do
customer.upcase
end
end

Facter.add('eypconf_customer_lowercase') do
setcode do
customer.downcase
end
end
end
25 changes: 25 additions & 0 deletions lib/facter/eypconf_platform.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
if File.exists?('/opt/eypconf/id/platformid.sh') then
platformid = Facter::Util::Resolution.exec('bash /opt/eypconf/id/platformid.sh').to_s
else
platformid = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/platformid ]; then cat /opt/eypconf/id/platformid | paste -sd,; fi\'').to_s
end

unless platformid.nil? or platformid.empty?
Facter.add('eypconf_platformid') do
setcode do
platformid
end
end

Facter.add('eypconf_platformid_uppercase') do
setcode do
platformid.upcase
end
end

Facter.add('eypconf_platformid_lowercase') do
setcode do
platformid.downcase
end
end
end
25 changes: 0 additions & 25 deletions lib/facter/eypconf_projectid.rb

This file was deleted.

0 comments on commit 3417cd7

Please sign in to comment.