Skip to content
Advertisement

How to test for existence of a file on the Puppet Master

In a customized modules on Puppet I have

JavaScript

and I want to let the module do something whether or not the file “fqdn-of-server” exist on the Puppet Master. Googling did get me a file_exists.rb function:

JavaScript

and this does work when put in something like:

JavaScript

in my manifest init.pp (of course $fqdn is a facter). The problem is that it works only on the client (so $does_fqdn_file_exists is 1 if the /tmp/$fqdn exist on the client $fqdn, it does not work on the puppet master.

Also, I want to use puppet:/// uri structures in this construct, but thus sofar, my function doesn’t understand this uri.

Can somebody help me ? The ruby function stems from someone on the web, who claims that it checks the file existence on the master, which is not the case (at least not what I can see).

Advertisement

Answer

In the puppet master you could test it like this:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement