Issue #4885 has been updated by Brice Figureau.
Nigel Kersten wrote: > Josh Cooper wrote: > > I like Brice's suggestion `source => "module://foo.conf"` as it's compact, > > simplifies the migration path, and would not affect our ability to support > > http(s) as the file source (see #5783) > > Is that literally "module" ? or the name of the module? I meant literally module. And this would mean get the file in the current module. > If it's the former, it doesn't save anything over "puppet" and how do you > distinguish between a file in a subdirectory of the 'local' module and a file > from a different module? > > If it's the latter, then we've got namespace collisions between module names > and future supported protocols. > > I really think we should be optimizing for the most common cases. > > 1. files from within the current module Yes, that's the more frequent case isn't it? > 1. files from another module This would be a very bad practice. > 1. then care about future protocols we haven't yet implemented... > > The vast vast majority of the time you're dealing with case (1). Yes and that's why I thought my proposal would be a good fit. Either you use "module://foo.txt" or the "puppet://" old syntax. That would cover your 1. and 2. The problem with the '~' is that we're adding a complexity to the language, and that's really not natural. Worst it's not even an operator, since it is embedded in a string. We're already have some difficulties to make sure users understand the spaceship operator, this one will be really difficult to explain to new users. ---------------------------------------- Feature #4885: Simplify the syntax for specifying file paths in modules using a '~' https://projects.puppetlabs.com/issues/4885 Author: Nigel Kersten Status: Accepted 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.
