1

I mount Cloudfuse to access Rackspace's Cloudfiles using Puppet, but on a new host, mount runs too soon, even though I require the whole class. In Pro Puppet, James recommends splitting class definitions like this:

class cloudfuse{
  include cloudfuse::install, cloudfuse::service, cloudfuse::config
}

class cloudfuse::install{
  # download and install
}

class cloudfuse::config{
  file{'/root/.cloudfuse':
    notify => Class['cloudfuse::service'],
  }
}

class cloudfuse::service{
  service{'cloudfuse':
    ensure => running,
  }
}

That works just fine. When I'm ready to mount, I require the top-level, parent class, like this:

exec{'mount /data/cloudfiles':
  command => "/usr/local/bin/cloudfuse /data/cloudfiles",
  require => [
    File['/data/cloudfiles'],
    Class['cloudfuse'],
  ]
}

Questions are:

  1. Is this idiomatic? I've seen this elsewhere, so I'd say it is.
  2. Should I actually require cloudfuse::install instead of the parent?

I know that requiring cloudfuse::install will fix my problem, but if I have a very simple class, maybe I won't split in three like this, then I'd have to guess / look at the manifest to know how to declare the dependency.

1 Answer 1

7

Disclosure, I am one of the developers of Puppet.

Unfortunately, a bug in Puppet means that a class that only contains other classes doesn't cause transitive dependencies. You can use the "anchor" pattern to work around that, or you can add an otherwise meaningless resource to the top level class, as in:

class cloudfuse {
  include cloudfuse::install, ...
  notify { "hate #8040": message => "work around bug #8040" }
}

You can follow bug #8040 to watch for when we finally get this fixed.

3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .