简体   繁体   中英

puppet couldn't retrieve information from source

My Puppet manifest looks like this

$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.

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

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

You cannot implicitly convert an array to a string in the source attribute like that and expect desired behavior.

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:

['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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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