Skip to content

Commit

Permalink
scripts for userid and magic hash
Browse files Browse the repository at this point in the history
  • Loading branch information
jordiprats committed May 17, 2017
1 parent 74402b4 commit e980a47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/facter/eypconf_magic_hash.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
magichash = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/.magic ]; then cat /opt/eypconf/id/.magic | paste -sd,; else echo "deadbeef"; fi\'').to_s
if File.exists?('/opt/eypconf/id/magic.sh') then
magichash = Facter::Util::Resolution.exec('bash /opt/eypconf/id/magic.sh').to_s
else
magichash = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/.magic ]; then cat /opt/eypconf/id/.magic | paste -sd,; else echo "deadbeef"; fi\'').to_s
end

unless magichash.nil? or magichash.empty?
Facter.add('eypconf_magic_hash') do
Expand Down
6 changes: 5 additions & 1 deletion lib/facter/eypconf_userid.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
userid = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/customer ]; then cat /opt/eypconf/id/customer | paste -sd,; else echo "defaultcustomer"; fi\'').to_s
if File.exists?('/opt/eypconf/id/userid.sh') then
userid = Facter::Util::Resolution.exec('bash /opt/eypconf/id/userid.sh').to_s
else
userid = Facter::Util::Resolution.exec('bash -c \'if [ -f /opt/eypconf/id/userid ]; then cat /opt/eypconf/id/userid | paste -sd,; fi\'').to_s
end

unless userid.nil? or userid.empty?
Facter.add('eypconf_userid') do
Expand Down

0 comments on commit e980a47

Please sign in to comment.