Hi,

i need to check if a file exists on the puppet master.
No big deal:
http://stackoverflow.com/questions/18784329/how-to-test-for-existence-of-a-file-on-the-puppet-master

So i made:
--
cat ./modules/braveconf/lib/puppet/parser/functions/file_exists.rb
require"puppet"
  module Puppet::Parser::Functions
    newfunction(:file_exists, :type => :rvalue) do |args|
    if File.exists?(args[0])
      return 1
    else
      return 0
    end
  end
end
--

Now, my problem is about path.

Since i have environmentpath, as seen is
puppet config print  environmentpath --section master --environment development
/etc/puppetlabs/code/environments

I would like to use, in the manifest:
--
if ( file_exists 
("${::environmentpath}/${::environment}/modules/module/files/configfile-${::hostname}")
 == 1 ) {
--

But ${::environmentpath} is empty.

How can i manage this topic, avoiding to hardcode 
/etc/puppetlabs/code/environments in the code?
Is there a way to get variable from puppet master config?

Thanks,
Daniele


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/6429762B-377B-4B9D-B8B4-526859465283%40retaggio.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to