Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am receiving the following error on a Puppet agent when trying to install multiple packages at once:

err: /Stage[main]/Template::Infrastructure/Package[undef]/ensure: change from absent to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install undef' returned 1: Error: Nothing to do

The code generating the error is:

$packages = [ 'qemu-kvm', 'qemu-kvm-tools', 'drbd84-tools', 'kmod-drbd84' ]
package {
  $::packages :
    ensure  =>  'installed',
    require =>  Class['yumrepos::elrepo']

The problem is intermittent. Is there a better way to install multiple packages at once without having to setup a package resource for each?

share|improve this question
up vote 4 down vote accepted

Using it as $::packages states explicitly that you want the variable to be looked up in the top scope, outside of any class. Since you seem to be defining it inside a class, this won't work.

Just use package { $packages: or package { $classname::packages: instead.

share|improve this answer
Thanks, I had not quite a grasp on the difference of first looking in top scope. The way the variable is used makes much more sense to me now. – Andy Shinn Sep 10 '12 at 21:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.