Puppet 将符号链接的内容复制到目录

Puppet 将符号链接的内容复制到目录,puppet,Puppet,我正在尝试将符号链接目录的内容复制到Windows上的普通目录: file { "copy symlink contents to directory": ensure => directory, path => "C:/Users/devacct/Desktop/puppet/puppet_dir2/", #directory source => "C:/Users/devac

我正在尝试将符号链接目录的内容复制到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,
}
此操作失败,并显示错误消息:

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

将符号链接路径作为源属性的值是否有效?如果没有,我如何实现我的目标?

使用
文件上的
链接
属性
块和
follow

另外,设置不带最后一个反斜杠的源。。。试试这个

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              => 'follow',
    #ignore             => $ignore_files,
    #purge              => $purge,
    force              => true,
}

是的,通常使用符号链接作为源参数是有效的,正如Kelson Silva所指出的,您还需要使用
links=>follow
而不是
links=>manage
(请参阅)

我不知道你为什么会收到这个错误消息

FWIW,我在Mac OS X上测试了以下内容:

设立:

$ ls -ld /tmp/symlink
lrwxr-xr-x  1 alexharvey  wheel  10 12 May 16:31 /tmp/symlink@ -> realsource
$ ls -lL /tmp/symlink
total 0
drwxr-xr-x  5 alexharvey  wheel  160 12 May 16:30 a/
drwxr-xr-x  5 alexharvey  wheel  160 12 May 16:30 b/
drwxr-xr-x  5 alexharvey  wheel  160 12 May 16:30 c/
$ find /tmp/symlink/
/tmp/symlink/
/tmp/symlink//a
/tmp/symlink//a/f
/tmp/symlink//a/d
/tmp/symlink//a/d/somefile
/tmp/symlink//a/e
/tmp/symlink//c
/tmp/symlink//c/f
/tmp/symlink//c/d
/tmp/symlink//c/e
/tmp/symlink//b
/tmp/symlink//b/f
/tmp/symlink//b/d
/tmp/symlink//b/e
代码:

结果:

Notice: Compiled catalog for harveya-c02vj38lhtd7-ume.local in environment production in 0.03 seconds
Notice: /Stage[main]/Test/File[/tmp/dest]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/a]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/a/d]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/a/d/somefile]/ensure: defined content as '{md5}d41d8cd98f00b204e9800998ecf8427e'
Notice: /Stage[main]/Test/File[/tmp/dest/a/e]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/a/f]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/b]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/b/d]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/b/e]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/b/f]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/c]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/c/d]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/c/e]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/c/f]/ensure: created
Notice: Applied catalog in 0.13 seconds

两者都试过了。删除反斜杠不起作用。我尝试将
follow
manage
作为链接
属性的值,但都不起作用。它抛出与我提到的相同的错误。@dot,您是否尝试不使用尾随/after文件SYM?我只是在猜测,但我想知道这是否会导致Windows出现问题?
Notice: Compiled catalog for harveya-c02vj38lhtd7-ume.local in environment production in 0.03 seconds
Notice: /Stage[main]/Test/File[/tmp/dest]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/a]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/a/d]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/a/d/somefile]/ensure: defined content as '{md5}d41d8cd98f00b204e9800998ecf8427e'
Notice: /Stage[main]/Test/File[/tmp/dest/a/e]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/a/f]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/b]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/b/d]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/b/e]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/b/f]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/c]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/c/d]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/c/e]/ensure: created
Notice: /Stage[main]/Test/File[/tmp/dest/c/f]/ensure: created
Notice: Applied catalog in 0.13 seconds