Tharanga Abeyseela
Tharanga Abeyseela

Reputation: 3483

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

Upvotes: 1

Views: 486

Answers (1)

Matthew Schuchard
Matthew Schuchard

Reputation: 28884

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

Upvotes: 3

Related Questions