Reputation: 179
I've got a puppet manifest using an array to define some required packages to be installed by APT. I've also got some resource chaining occurring to specify dependencies (I don't want to use 'requires' or 'before' because it makes the code difficult to read. The problem is in the chaining line, the array gets expanded and breaks the chaining. I've followed the custom function workaround here Puppet Syntax: how to include an array of objects into an ordering -> chain? which works but seems a bit overkill to define a function.
$my_deps = ["autoconf", "automake1.9", "autotools-dev", "binutils"]
package { $my_deps:
ensure => installed,
}
exec {'c_update_apt':
command => '/usr/bin/apt-get update',
path => '/usr/bin/',
}
Exec['c_update_apt'] -> Package[ $my_deps ]
This errors saying 'Package[autoconf]Package[automake1.9].... not matched'. Any suggestions most appreciated.
Upvotes: 0
Views: 1117
Reputation: 2914
You could use the '<| |>' collection syntax to make sure the Exec block is executed before any packages are installed, instead of just the 4 in your list.
Exec['c_update_apt'] -> Package <| |>
See the bottom of the http://docs.puppetlabs.com/guides/language_guide.html#chaining-resources section.
Upvotes: 1