Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 want to use puppet to manage a hadoop cluster. On the machines we have several directories which must be created and set permissions.

But i'm unable to add array values for defined methods.

define hdfs_site( $dirs ) {
    file { $dirs:
        ensure => directory,
        owner => "hadoop",
        group => "hadoop",
        mode  => 755;

    file {
            content => template("hdfs-site.xml.erb"),
            owner   => "root",
            group   => "root",
            mode    => 644;

define hadoop_slave( $mem, $cpu, $dirs ) {
    hadoop_base {
        mem => $mem,
        cpu => $cpu,

    hdfs_site {
        dirs => $dirs,

hadoop_base is similar to hdfs_site.


The error message was:

Could not parse for environment production: All resource specifications require names; expected '%s' at /etc/puppet/modules/hadoop/manifests/init.pp:52

which is the $dirs line in hadoop_slave

share|improve this question
I wanted to explain what is in site.pp but serverfault threw an exception :( – KARASZI István May 10 '10 at 15:17
Please define how you being "unable to add array values for defined methods" manifests itself in form of error messages or unwanted side effects. – joschi May 10 '10 at 15:54
up vote 7 down vote accepted

As the message tells you, any resource specification requires a name.

In your specific case the following snippet should work:

define hadoop_slave( $mem, $cpu, $dirs ) {
    hadoop_base { "${name}_hadoop_base":
        mem => $mem,
        cpu => $cpu,

    hdfs_site { "${name}_hdfs_site":
        dirs => $dirs,
share|improve this answer

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.