Copy contents of symlink to directory

asked 2018-05-11 13:27:49 -0500

hsubraveti gravatar image

updated 2018-05-11 13:30:36 -0500

I am trying to copy contents of a symlink directory to a normal directory on Windows.

file { "copy symlink contents to directory":
    ensure             => directory,
    path               => "C:/Users/devacct/Desktop/puppet/puppet_dir2/", #directory
    source             => "C:/Users/devacct/Desktop/puppet/filessym/", #symlink
    recurse            => true,
    source_permissions => ignore,
    links              => 'manage',
    #ignore             => $ignore_files,
    #purge              => $purge,
    force              => true,

This fails with an error message.

Error: /Stage[main]/Custom::Profile::Symlink/File[copy symlink contents to directory]: Could not evaluate: Could not retrieve information from environment production source(s) file:/C:/Users/devacct/Desktop/puppet/filessym

Is it valid to give symlink path as a value to source attribute? If not, how do I achieve my objective? Link to Stackoverflow question

edit retag flag offensive close merge delete


`source` is a file/directory _on_ your Puppet server, where your puppet master runs (assuming you are in a client-server-environment). You can not copy files on the client using a file resource. You'd have to utilize an exec resource instead.

Kai Burghardt gravatar imageKai Burghardt ( 2018-05-13 03:55:06 -0500 )edit