Ask Your Question

Retrive list from hiera

asked 2013-04-26 07:29:27 -0600

dawud gravatar image

Given the following module:

class clamav {

  package { $clamav::packages:
    ensure => installed,

And the hierarchical data structure:


  - yaml
  - "%{::hostname}"
  - common
  :datadir: "/etc/puppet/hieradata/%{::domain}/%{::operatingsystem}"

common.yaml (snippet):

  - 'clamav-unofficial-sigs'
  - 'clamav-db'
  - 'clamav'
  - 'clamd'

In the puppetmaster node, I've checked that I can retrieve the data:

# hiera -a clamav::packages operatingsystem=CentOS
["clamav-unofficial-sigs", "clamav-db", "clamav", "clamd"]

However, puppet agent --test, despite compiling the catalog without errors, is failing with:

Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install undef' returned 1: Error: Nothing to do
Error: /Stage ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-26 08:04:16 -0600

llowder gravatar image

If you are using puppet3 and trying to make use of databindings, you need to change your code to:

class clamav (

  package { $packages:
    ensure => installed,

If you want, you can provide a default set of pacakges or even just an empty array ($packages = [],).

If you are not using puppet 3, then add:

$packages = hiera('clamav::packages')

to the class. I would do that as the param still, so you can easily override it and will make the code easier to transition to puppet 3's databindings once you switch to puppet 3.

edit flag offensive delete link more


As a matter of fact, I have switched to puppet 3 already, and I was trying to use some of the new possibilities. One of the things I wanted to ...(more)

dawud gravatar imagedawud ( 2013-04-26 13:31:01 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-04-26 07:29:27 -0600

Seen: 3,322 times

Last updated: Apr 26 '13