Feature #1946

let file() obtain file contents from fileserver and/or module space

Added by martin krafft about 3 years ago. Updated 7 months ago.

Status:Duplicate Start date:02/08/2009
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:fileserving
Target version:-
Affected Puppet version:0.24.5 Branch:
Keywords:performance scaling
Votes: 4

Description

file() as it is requires an absolute pathname.

It would be nice if relative pathnames would be resolved relative to the root of the fileserver ‘files’ hierarchy, unless they start out with a module name, in which case the module space should be searched.

For instance

file(“etc/motd”) ==> puppet:///files/etc/motd files(“motd/etc/motd”) ==> …/modules/motd/files/etc/motd

find_file.patch (2 kB) Andras Elso, 05/22/2011 11:35 am


Related issues

duplicates Puppet - Feature #5158: File resources: Make source/content parameters and the fi... Needs Decision 10/30/2010
duplicated by Puppet - Bug #2771: file function should use puppet://url/module/ nomenclatur... Duplicate 11/02/2009
duplicated by Puppet - Feature #4749: file() function should behave like template() in acceptin... Duplicate 09/09/2010

History

Updated by martin krafft about 3 years ago

The last line should have been file(), not files():

file(“motd/etc/motd”) > …/modules/motd/files/etc/motd

Updated by James Turnbull about 3 years ago

  • Status changed from Unreviewed to Needs Decision
  • Assignee set to Luke Kanies

Updated by Luke Kanies about 3 years ago

  • Category set to fileserving
  • Status changed from Needs Decision to Accepted

There certainly needs to be some way to load module files this way, but there’s no canonical ‘files’ section in the fileserver.

As a general rule, though, I agree – accepting a URI would make sense, and then we can pass it through the normal file routing process. I’d only accept this as a URI, though.

Updated by Luke Kanies over 2 years ago

  • Assignee deleted (Luke Kanies)
  • Target version set to 2.6.0

Updated by James Turnbull about 2 years ago

  • Target version changed from 2.6.0 to 2.7.x

Updated by Anonymous about 2 years ago

  • Keywords set to performance scaling

Talking with eric0 online, the reason he wants “url” is not just for path convience as this subject suggests, but to use other transports.

For instance https:// provides better load balanancing and speed options.

(Other folks may want to choose to use NFS. (Or even smbfs). Naturally those could be mounted, though we should keep Windows fileshare notation in mind.)

I realize security is somewhat different here, but may not matter deeply in all environments and may only be bypassed for large files.

Updated by Nigel Kersten 10 months ago

  • Status changed from Accepted to Duplicate

Martin, I’m closing in favor of #5158 where we’re heading towards the larger goal of making template and file consistent, and to have the functionality you’ve requested here.

Updated by Andras Elso 9 months ago

Added a little hack to do this. (currently works only in module, because i’m not a ruby programmer)

$foo = file(“modulename/filename”) –> /etc/puppet/module/modulename/files/filename but you can use the fullpath too

Updated by Nigel Kersten 9 months ago

Andras would you mind attaching your patch to #5158 instead please?

Updated by James Turnbull 7 months ago

  • Target version deleted (2.7.x)

Also available in: Atom PDF