| One of Puppet's most confusing long-standing idioms is its use of pseudo-relative module file references. Most notably, in file(), template(), and related functions.
# This retrieves content from <moduledir>/modname/files/filename |
file('modname/filename') |
|
# This retrieves content from <moduledir>/modname/templates/filename |
template('modname/filename') |
This is difficult for new users to understand, and when ported to the command-line it breaks normal Unix behavior in that forward-slash does not reliably indicate a real file path, even relatively. Feature Request Anywhere these confusing references are used, permit instead full-relative path references, following this convention: <modulename>/full/relative/path So, the examples above could be used instead as:
# This retrieves content from <moduledir>/modname/files/filename |
file('modname/files/filename') |
|
# This retrieves content from <moduledir>/modname/templates/filename |
template('modname/templates/filename') |
The same way that it has become best practice to always use a DSL option that includes the literal string "facts" when referencing facts for clarity*, this capability would improve intuitiveness, readability, and discoverability for new users. This will also make using a full-relative module path more tenable in CLI applications. * e.g., don't use $::osfamily. Use getvar('facts.osfamily) or $facts['osfamily'] instead. |