A better_file function which knows about puppet:/// uris
Tomas Doran

Tomas Doran



8,576 latest version

3.5 quality score

Version information

  • 0.0.1 (latest)
released Jul 3rd 2019

Start using this module


bobtfish/better_file — version 0.0.1 Jul 3rd 2019


Build Status

####Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Usage - Using the better_file function
  4. Limitations - OS compatibility, etc.
  5. Development - Guide for contributing to the module


A better_file function which slurps files from full paths or puppet:/// uris

##Module Description

The puppet builtin file() function is severely limited as it will only operate on fully qualitied paths.

This is a well known issue.

This function fixes (or at least hacks around) that limitation for the common cases.


###With a full path name


Works exactly like the built in file() function

###With a module uri


Will resolve 'my_module' to a path on disk in the current environment, and will look inside the files/ subdirectory for that module

For example if your modules are in /etc/puppet/modules, then the above will try to find the file in /etc/puppet/modules/files/myfile

With a files uri


This will assume that your files are located under the $confdir/files (e.g. /etc/puppet/files)


Unless your fileserver is configured to serve the 'files' repository from $confdir/files then puppet:///files/ uris will not work.

Custom fileserver modules are unsupported.


Patches are welcome!

Please open a pull request on github :)