Forge Home

better_file

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

9,892 downloads

9,892 latest version

3.5 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.0.1 (latest)
released Jan 27th 2014

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'bobtfish-better_file', '0.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add bobtfish-better_file
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install bobtfish-better_file --version 0.0.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

bobtfish/better_file — version 0.0.1 Jan 27th 2014

#better_file

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

##Overview

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.

##Usage

###With a full path name

better_file('/a/full/path')

Works exactly like the built in file() function

###With a module uri

better_file('puppet:///modules/my_module/myfile')

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

better_file('puppet:///files/myfile')

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

##Limitations

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.

##Development

Patches are welcome!

Please open a pull request on github :)