Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

Commit

Permalink
(#6) Add webconsole boolean class parameter
Browse files Browse the repository at this point in the history
This class parameter allows the module user to easily configure if they
want to enable or disable the ActiveMQ web console by default.

This wraps the configuration setting in a boolean check in the ERB
template.

Validation is done on the class parameter and the _real convention is
followed.
  • Loading branch information
Jeff McCune committed Jun 21, 2011
1 parent 5cf9265 commit 412bf40
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions manifests/init.pp
Expand Up @@ -27,14 +27,17 @@
class activemq(
$version = 'present',
$ensure = 'running',
$webconsole = true,
$server_config = 'UNSET'
) {

validate_re($ensure, '^running$|^stopped$')
validate_re($version, '^present$|^latest$|^[._0-9a-zA-Z:-]+$')
validate_bool($webconsole)

$version_real = $version
$ensure_real = $ensure
$webconsole_real = $webconsole

# Since this is a template, it should come _after_ all variables are set for
# this class.
Expand Down
6 changes: 5 additions & 1 deletion templates/activemq.xml.erb
Expand Up @@ -6,12 +6,14 @@
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

<% if webconsole_real -%>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.base}/conf/credentials.properties</value>
</property>
</bean>

<% end -%>
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" useJmx="true">
<managementContext>
<managementContext createConnector="false"/>
Expand Down Expand Up @@ -60,5 +62,7 @@
</transportConnectors>
</broker>

<import resource="jetty.xml"/>
<% if webconsole_real -%>
<import resource="jetty.xml"/>
<% end -%>
</beans>
4 changes: 3 additions & 1 deletion tests/init.pp
Expand Up @@ -6,7 +6,9 @@
version => 'latest',
}
->
class { 'activemq': }
class { 'activemq':
webconsole => true,
}
->
notify { 'omega': }
}
14 changes: 14 additions & 0 deletions tests/init_disable_webconsole.pp
@@ -0,0 +1,14 @@
node default {
notify { 'alpha': }
->
class { 'java':
distribution => 'jdk',
version => 'latest',
}
->
class { 'activemq':
webconsole => false,
}
->
notify { 'omega': }
}

0 comments on commit 412bf40

Please sign in to comment.