Issue #4885 has been updated by Daniel Pittman.
Status changed from Accepted to Needs Decision
Gary Larizza wrote:
> We had this discussion in class today, and the suggestion was put up as this:
>
> [...]
>
> This simplifies the syntax AND makes templates and files function similarly.
> Now, of course, it assumes that we're filling in "puppet:///modules/'
> beforehand, but Templates ALREADY have a similar 'magic' about them. We
> would still support the full syntax, and also have this syntax for modules.
> Passing a source that doesn't begin with a '/' would be assumed to be coming
> from the module.
>
> Thoughts? Comments? Snide Remarks?
Of the options, this seems like the best "magic" choice. Allowing anything
that looks like a URI to behave like a URI, and a relative path to be treated
as "inside the module" seems sensible.
The only other thing I have of value in this thread is to mention the existence
of a "protocol independent relative URI":
://hostname/resource # <- relative to the current protocol
I would entertain the idea that `puppet:${module}/${path}` should do the
expansion magic, and `puppet://${hostname}/${module}/${path}` is the full
version. Given that, and protocol relative URI expansion, that could
abbreviate to `:${module}/${path}` for power users. (eg: we don't heavily
advertise that ability, but we do allow it, and if you want to abbreviate your
manifests, you can go right ahead.)
Finally, I want to remind y'all that we are proposing to support `file {
"example": source => "http{,s}://example.com/resource.data" }`, and that some
of the community are threatening to implement that at the moment. I don't have
a strict timeline, but "just Puppet as the protocol" will probably not last
forever.
Occasional ideas of experimenting with, eg, the source being a filebucket hash,
or using some peer-to-peer protocol as the source are also floated, and I
absolutely do not want to lock those options out with the syntax here.
----------------------------------------
Feature #4885: Simplify the syntax for specifying file paths in modules using a
'~'
https://projects.puppetlabs.com/issues/4885
Author: Nigel Kersten
Status: Needs Decision
Priority: Normal
Assignee:
Category:
Target version: Telly
Affected Puppet version:
Keywords:
Branch:
There is too much redundant info in puppet file source specifications in
modules.
<pre>
file { "ugly":
source => "puppet:///modules/foo/bar",
}
</pre>
Additionally, we're inconsistent with our template() and file() functions.
template() takes either a path relative to the modulepath, dereferencing to
"templates" sub-directories of the module or an absolute path.
file() takes an absolute path only.
I suggest (after a flash of inspiration from Patrick on the mailing list) we
use the '~' syntax in a standard unix-y way to refer to module locations as
follows.
Each class mentioned below corresponds to a module.
File source:
Reference: $modulepath/modules/foo/files/bar
<pre>
class foo {
file { "booyah":
source => "~/bar",
}
}
class notfoo {
file { "booyah2":
source => "~foo/bar",
}
}
</pre>
Template function:
Reference: $modulepath/modules/foo/templates/bar.erb
<pre>
class foo {
file { "booyah":
content => template("~/bar.erb"),
}
}
class notfoo {
file { "booyah2":
content => template("~foo/bar.erb"),
}
}
</pre>
File function:
Reference: $modulepath/modules/foo/files/bar
<pre>
class foo {
file { "booyah":
content => file("~/bar"),
}
}
class notfoo {
file { "booyah2":
content => file("~foo/bar"),
}
}
</pre>
I believe we should be able to make this change without breaking any of the
existing behavior. I do believe we should aim to deprecate the old template
function, but that can be a separate discussion.
I haven't actually spent time ensuring this is possible. This is just what I
would like to see.
Mailing list thread references so we don't re-hash the same questions over
again unless needed:
http://groups.google.com/group/puppet-dev/browse_frm/thread/688050b8f0668ff2
http://groups.google.com/group/puppet-users/browse_frm/thread/688050b8f0668ff2
(was cross-posted, which never works out well. )
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.