木偶文件功能不加载内容

puppet file function doesn't load contents

我正在尝试通过以下方式使用人偶文件功能(不是类型)

class iop_users {

include 's3file::curl'
include 'stdlib'

$secretpath=file('/etc/secret','dev/null')

notify { 'show secretpath':
  message =>"secretpath is $secretpath"
}

s3file { '/opt/utab.yaml':
  source => "mybucket/$secretpath/utab.yaml",
  ensure => 'latest',
}

exec { 'fix perms':
  command => '/bin/chmod 600 /opt/utab.yaml',
  require => S3file['/opt/utab.yaml']
}


if ( $::virtual == 'xenhvm' and defined(S3file['/opt/utab.yaml']) ) {
  $uhash=loadyaml('/opt/utab.yaml')
  create_resources(iop_users::usercreate, $uhash)
}

}

如果我 运行 这是一些典型的输出。清单失败,因为用于查找路径的初始 "secret" 未加载

https_proxy=https://puppet:3128 puppet agent -t 
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for ip-10-40-1-68.eu-west-1.compute.internal
Info: Applying configuration version '1431531382'
Notice: /Stage[main]/Iop_users/S3file[/opt/utab.yaml]/Exec[fetch /opt/utab.yaml]/returns:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Notice: /Stage[main]/Iop_users/S3file[/opt/utab.yaml]/Exec[fetch /opt/utab.yaml]/returns:                                  Dload  Upload   Total   Spent    Left  Speed
Notice: /Stage[main]/Iop_users/S3file[/opt/utab.yaml]/Exec[fetch /opt/utab.yaml]  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
Notice: /Stage[main]/Iop_users/S3file[/opt/utab.yaml]/Exec[fetch /opt/utab.yaml]/returns: curl: (56) Received HTTP code 404 from proxy after CONNECT
Error: curl -L -o /opt/utab.yaml https://s3-eu-west.amazonaws.com/mybucket//utab.yaml returned 56 instead of one of [0]
Error: /Stage[main]/Iop_users/S3file[/opt/utab.yaml]/Exec[fetch /opt/utab.yaml]/returns: change from notrun to 0 failed: curl -L -o /opt/utab.yaml https://s3-eu-west.amazonaws.com/mybucket//utab.yaml returned 56 instead of one of [0]
Notice: /Stage[main]/Iop_users/Exec[fix perms]: Dependency Exec[fetch /opt/utab.yaml] has failures: true
Warning: /Stage[main]/Iop_users/Exec[fix perms]: Skipping because of failed dependencies
Notice: secretpath is 
Notice: /Stage[main]/Iop_users/Notify[show secretpath]/message: defined 'message' as 'secretpath is '
Notice: Finished catalog run in 1.28 seconds

但是在上面的 puppet 代理 运行 失败的同一台主机上,如果我使用 "apply" 在清单上下文之外尝试它,它工作正常

puppet apply -e '$z=file("/etc/secret") notify { "z": message => $z}'
Notice: Compiled catalog for ip-x.x.x.x.eu-west-1.compute.internal in environment production in 0.02 seconds
Notice: wombat

Notice: /Stage[main]/Main/Notify[z]/message: defined 'message' as 'wombat
'
Notice: Finished catalog run in 0.03 seconds

我做错了什么?我可以采用更好的替代方法吗?

像往常一样,我对人偶的工作方式感到困惑

显然,函数总是在 master 上执行

因此以这种方式加载的任何文件都必须在主服务器上

一旦我向 puppetmaster 添加了一个“/etc/secret”文件,它就全部工作了