1

I want to be able to add some requires to a file I setup:

define daemontools::service(
  $ensure = 'running',
  $source
){
  case $ensure {
    'running': { $real_ensure = $source }
    'stopped': { $real_ensure = 'absent' }
    default: { fail("no such ensure for daemontools::service") }
  }

  file{"/etc/service/${name}":
    ensure => $real_ensure,
    require=> Package['daemontools']
  }

  # This is the part that gets confusing
  if $require {
    File["/etc/service/${name}"]{ require +> $require }
  }
}

# in some other class somewhere

daemontools::service{"tinydns": 
  source=>'/var/tinydns', 
  require => [Package['djbdns'],Exec['tinydns_setup']]
}

The LanguageTutorial seems to think this will work, but it only results in the error message: Parameter 'require' is already set on File[/etc/service/tinydns] by daemontools::service

1 Answer 1

2

Get rid of the if $require -- it's completely unnecessary. Metaparameters like require apply to defined types just as well as they do to native types, so nothing in your daemontools::service resource will run until the requires on it are successfully run.

1
  • Doh, easier than I thought...
    – gnarf
    Sep 20, 2009 at 2:38

You must log in to answer this question.

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