简体   繁体   English

puppet无法从源中检索信息

[英]puppet couldn't retrieve information from source

My Puppet manifest looks like this 我的Puppet清单看起来像这样

$abrt_config = [ 'abrt.conf','abrt-action-save-package-data.conf' ]

file { $abrt_config:
  ensure => present,
  path   => "/etc/abrt/${abrt_config}",
  owner  => 'root',
  group  => 'root',
  mode   => '0644',
  source => "puppet:///modules/abrt/${abrt_config}",
}

My config files are located in the following path. 我的配置文件位于以下路径中。

/abrt/files/abrt.conf
/abrt/files/abrt-action-save-package-data.conf

I'm getting the following error when executing puppet on client nodes. 在客户端节点上执行puppet时出现以下错误。

Error: /Stage[main]/Abrt/File[/etc/abrt/abrt-action-save-package-data.conf]: Could not evaluate: Could not retrieve information from environment development source(s) puppet:///modules/abrt//etc/abrt/abrt.conf/etc/abrt/abrt-action-save-package-data.conf 错误:/Stage[main]/Abrt/File[/etc/abrt/abrt-action-save-package-data.conf]:无法评估:无法从环境开发源中检索信息puppet:///模块/ ABRT //等/ ABRT / abrt.conf的/ etc / ABRT / ABRT - 动作 - 保存封装-data.conf

Error: /Stage[main]/Abrt/File[/etc/abrt/abrt.conf]: Could not evaluate: Could not retrieve information from environment development source(s) puppet:///modules/abrt//etc/abrt/abrt.conf/etc/abrt/abrt-action-save-package-data.conf 错误:/Stage[main]/Abrt/File[/etc/abrt/abrt.conf]:无法评估:无法从环境开发源中检索信息puppet:/// modules / abrt // etc / abrt /abrt.conf/etc/abrt/abrt-action-save-package-data.conf

You cannot implicitly convert an array to a string in the source attribute like that and expect desired behavior. 您不能将数组隐式转换为source属性中的字符串,并期望所需的行为。

If you are using a non-obsolete version of Puppet, then you can use a lambda iterator to solve this problem in the following way: 如果您使用的是非过时版本的Puppet,那么您可以使用lambda迭代器以下列方式解决此问题:

['abrt.conf', 'abrt-action-save-package-data.conf'].each |$abrt_config| {
  file { $abrt_config:
    ensure => present,
    path   => "/etc/abrt/${abrt_config}",
    owner  => 'root',
    group  => 'root',
    mode   => '0644',
    source => "puppet:///modules/abrt/${abrt_config}",
  }
}

Check the documentation here for more details: https://docs.puppet.com/puppet/4.8/function.html#each 有关详细信息,请查看此处的文档: https//docs.puppet.com/puppet/4.8/function.html#each

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM