Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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.

share|improve this answer
    
I don't really understand where anchors are coming from? They must be a type, but I don't see any implementation of it, or references to it from docs.puppetlabs.com/references/stable/type.html –  François Beausoleil Feb 21 '12 at 2:22
    
They are part of the puppet-stdlib module at github.com/puppetlabs/puppetlabs-stdlib or available on the forge. That link to the pattern page is a wiki, feel free to update it, or I will try to remember to make the link tomorrow. –  Daniel Pittman Feb 21 '12 at 2:24
    
Thanks for your time. I updated the wiki projects.puppetlabs.com/projects/puppet/wiki/Anchor_Pattern/… –  François Beausoleil Feb 21 '12 at 3:18
    
Thank you so much. :) –  Daniel Pittman Feb 21 '12 at 4:09

Your Answer

 
discard

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.