On Wednesday, August 8, 2012 5:56:42 PM UTC-5, Allen
wrote:>
> Is there a way to symbolically link files from one directory into another
> inside of Puppet? I did this:
>
> "/opt/openerp/server/openerp/addons/":
> owner => "openerp",
> group => "admin",
> links => "manage",
> ensure => directory,
> recurse => true,
> mode => 775,
> target => "/opt/openerp/web/addons/",
> require => Vcsrepo["/opt/openerp/server",
"/opt/openerp/web"];
>
> But it seems it actually copies them over instead of symbolically linking
> them. What I usuallly do, when I do it by hand is just run this command:
> "ln -s /opt/openerp/web/addons/*" while inside of the
> /opt/openerp/server/openerp/addons/ folder.
The "target" property is documented only for when you use "ensure
=>
link". It is then target of the (single) symbolic link the File resource
manages. I''m surprised that what you used copies anything, and,
indeed,
that it does not provoke an error. There is definitely a bug there, though
perhaps it is merely a doc omission.
For a File with "ensure => directory" and "recurse =>
true" you should be
specifying the "source" parameter. It looks like Puppet is using your
"target" in its stead, and doing exactly what it would do if you had
specified that as the source.
Ultimately, the File resource does not provide the behavior you are looking
for. It will copy links or their targets, and it will create links that
you specify explicitly, but it will not recursively make links to the
contents of source directories.
> Also, is there a way I can do this to multiple directories? I need to link
> from another couple of places into this directory and these are all from
> repositories so I''d rather symbolically link them so in case they
get
> updated, we can have them already updated inside of the system inside of
> that folder.
>
You have a few options, prominent among them:
- you could create a directory on the master containing all the wanted
symlinks, and source that directory. The links don''t need to point
to the
real files, and perhaps they can even be dangling
- you could use an Exec to manage your links
- you could just let Puppet make copies. When the source files change,
Puppet will copy the new versions on its next run.
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/0KvJ27MLn_sJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.