FAQ
Hello, I have a module "mywebapp" which calls the tomcat::war module with
specific parameters, to upgrade the war file and restart tomcat. This works
great. What I would like to do is modify the code so that if, and only if
tomcat needs to be restarted, BEFORE it is restarted, I want to perform a
file operation. I want to do this because the operation will tell our load
balancer the server is about to go offline, and not to direct any traffic
to the server. I don't want to do this unless the war file is actually
going to be upgraded, which only the tomcat::war type knows.

The tomcat::war module which looks roughly like this (I'm simplifying for
brevity):

define tomcat7::war (
     ... params
) {

   ... variable definitions ...

   file { "${tomcat7::sites_dir}/${destFile}":
     notify => Exec["clean_${tomcat7::sites_dir}/${contextPath}"],
   }

   exec { "clean_${tomcat7::sites_dir}/${contextPath}":
     command => "rm -rf ${contextPath} ; mkdir ${contextPath} ; unzip
${contextPath}.war -d ${contextPath}/",
     cwd => "${tomcat7::sites_dir}",
     notify => Class['tomcat7::service'],
   }
}

what I would like to do is pass a parameter into tomcat::war so that if
that the parameter is set, the class (or type) referenced in the parameter
is Notified instead of Exec["clean_${tomcat7::sites_dir}/${contextPath}"],
and then Exec["clean_${tomcat7::sites_dir}/${contextPath}"] would be
notified AFTER my code.

This would allow my code a chance to notify the load balancer and pause
before cleaning and restarting tomcat. I don't want the special
load-balancer code in tomcat::war, because it is unique to 'mywebapp'.

Is there a way to do this at all?

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/e3fa025b-8e81-46c0-b850-d05d90351ef6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
grouppuppet-users @
categoriespuppet
postedNov 26, '13 at 1:22p
activeNov 27, '13 at 10:25a
posts2
users2
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase