Hi,
I think you're overcomplicating.
I suppose you have something like
class mywebapp {
tomcat7::war { "mywebapp": ... }
}
You can wrench your code inbetween if you slightly modify your defined
type like so:
define tomcat7::war(...) {
file { "tomcat7-war-file-$name":
path => "${tomcat7::sites_dir}/${destFile}",
notify => Exec["clean-tomcat7-war-$name"],
}
exec { "clean-tomcat7-war-$name":
...
}
}
to make the interface more transparent. Then add to class mywebapp:
exec { "notify-loadbalancer":
command => ...
suscribe => File["tomcat7-war-file-mywebapp"],
before => Exec["clean-tomcat7-war-mywebapp"],
}
This is not exactly clean design, of course (use this pattern in enough
places and you've got a maintenance nightmare right on hand).
If you *want* to make it clean, you will have little choice but to
include the code in tomcat7::war after all, along with a new parameter
to explicitly enable it (e.g. $do_notify_loadbalancer = false).
If a compromise is acceptable, you may get away with making it somewhat
generic like
define tomcat7::war(
...
$pre_cleanup_hook = "") {
...
if $pre_cleanup_hook {
exec { "tomcat7-war-pch-$name":
command => "$pre_cleanup_hook",
subscribe => File[...],
before => Exec[...],
}
}
...
}
HTH,
Felix