Hi Arfoz,
this is the best example on how to _not_ do classes.
Every class should be self contained - as long as possible.
In your case you have a hard reference from one resource inside a class to another resource inside another class.
I always tell my training course attendees that they should never do this unless they don’t like themselves and they want to have Puppet nightmares.
In your case you can do the following hack:
make the add file class a parameterised class, set the parameter to the default behaviour:
class addfile (
$enable_notify => Service[’tomcat’],
) {
file {‘/tmp/hello’:
ensure => file,
notify => $enable_notify,
}
}
On systems where you don’t have tomcat class included you have to declare the class add file with parameter set to undef.
But: be aware that even this is not a good solution.
It’s just a hack.
Try to refacter your modules.
Best,
Martin
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
puppet-users...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/02cfc06d-d306-48a2-a917-7144606a1509%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.