From 6b38928c2fed4f3e4b3d45a0c8f47f29cc3b5839 Mon Sep 17 00:00:00 2001 From: Lyndon Washington Date: Wed, 18 Sep 2013 17:41:15 -0400 Subject: [PATCH] [COOK-2845] Fix misconfigured wrapper.conf and add Open SUSE support Signed-off-by: Seth Vargo --- .gitignore | 21 ++++- .kitchen.yml | 35 ++----- Gemfile | 11 +++ attributes/default.rb | 2 +- libraries/chef_activemq.rb | 40 ++++---- metadata.rb | 2 +- templates/default/activemq.xml.erb | 92 +++++++++++-------- .../serverspec/localhost/activemq_spec.rb | 14 +++ .../default/serverspec/spec_helper.rb | 11 +++ 9 files changed, 138 insertions(+), 90 deletions(-) create mode 100644 Gemfile create mode 100644 test/integration/default/serverspec/localhost/activemq_spec.rb create mode 100644 test/integration/default/serverspec/spec_helper.rb diff --git a/.gitignore b/.gitignore index 82d1b5c..a90cbbb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,21 @@ -.kitchen/ +*~ +*# +.#* +\#*# +.*.sw[a-z] +*.un~ +*.tmp +*.bk +*.bkup .kitchen.local.yml +Berksfile.lock +Gemfile.lock + +.bundle/ +.cache/ +.kitchen/ +.vagrant/ +.vagrant.d/ +bin/ +tmp/ +vendor/ diff --git a/.kitchen.yml b/.kitchen.yml index 4aa453b..74906ef 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,32 +1,17 @@ ---- driver_plugin: vagrant driver_config: require_chef_omnibus: true platforms: -- name: ubuntu-12.04 - driver_config: - box: opscode-ubuntu-12.04 - box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box - run_list: ["recipe[apt]"] - -- name: ubuntu-10.04 - driver_config: - box: opscode-ubuntu-10.04 - box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box - run_list: ["recipe[apt]"] - -- name: centos-6.4 - driver_config: - box: opscode-centos-6.4 - box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box - -- name: centos-5.9 - driver_config: - box: opscode-centos-5.9 - box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box + - name: ubuntu-12.04 + run_list: + - recipe[apt] + - name: ubuntu-10.04 + run_list: + - recipe[apt] + - name: centos-6.4 suites: -- name: default - run_list: ["recipe[activemq]"] - attributes: {} + - name: default + run_list: + - recipe[activemq] diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..127bb3e --- /dev/null +++ b/Gemfile @@ -0,0 +1,11 @@ +source 'http://rubygems.org' + +gem 'berkshelf', '~> 2.0' +gem 'chefspec', '~> 2.0' +gem 'foodcritic', '~> 2.2' +gem 'rubocop', '~> 0.12' + +group :integration do + gem 'test-kitchen', '~> 1.0.0.beta' + gem 'kitchen-vagrant', '~> 0.11' +end diff --git a/attributes/default.rb b/attributes/default.rb index 4e7fa5b..7484983 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -20,7 +20,7 @@ default['activemq']['mirror'] = "http://apache.mirrors.tds.net" default['activemq']['version'] = "5.8.0" default['activemq']['home'] = "/opt" -default['activemq']['wrapper']['max_memory'] = "512" +default['activemq']['wrapper']['max_memory'] = "1024" default['activemq']['wrapper']['useDedicatedTaskRunner'] = "true" default['activemq']['enable_stomp'] = true diff --git a/libraries/chef_activemq.rb b/libraries/chef_activemq.rb index b428e77..31d2d4a 100644 --- a/libraries/chef_activemq.rb +++ b/libraries/chef_activemq.rb @@ -19,30 +19,24 @@ # class Chef module ActiveMQ + # Returns the name of the jar file that contains the ActiveMQ main classes. Since ActiveMQ 5.8.0 the name + # of such jar file is "activemq.jar", prior to that it was "run.jar". + # + # @param node [Chef::Node] the Chef node + # + # @return [String] the name of the ActiveMQ jar file that should be included in the JVM Classpath. + def self.get_amq_jar_name(node) + version = node['activemq']['version'] + vMj, vMn, vRev = version.split('.').map { |v| Integer(v) rescue nil } - class << self - - # Returns the name of the jar file that contains the ActiveMQ main classes. Since ActiveMQ 5.8.0 the name - # of such jar file is "activemq.jar", prior to that it was "run.jar". - # - # @param node [Chef::Node] the Chef node - # - # @return [String] the name of the ActiveMQ jar file that should be included in the JVM Classpath. - def get_amq_jar_name(node) - - version = node['activemq']['version'] - - vMj,vMn,vRev = version.split(".").map{ |v| Integer(v) rescue nil } - runner = case - when vMj == 5 && vMn >= 8 - "activemq.jar" - when vMj >= 6 - "activemq.jar" - else - "run.jar" - end - runner - end + case + when vMj == 5 && vMn >= 8 + 'activemq.jar' + when vMj >= 6 + 'activemq.jar' + else + 'run.jar' + end end end end diff --git a/metadata.rb b/metadata.rb index 7427cd8..64c30df 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version "1.2.1" -%w{ubuntu debian redhat centos}.each do |os| +%w{ubuntu debian redhat centos suse}.each do |os| supports os end diff --git a/templates/default/activemq.xml.erb b/templates/default/activemq.xml.erb index 8125cbf..e8f47a3 100644 --- a/templates/default/activemq.xml.erb +++ b/templates/default/activemq.xml.erb @@ -25,7 +25,7 @@ - file:${activemq.base}/conf/credentials.properties + file:${activemq.conf}/credentials.properties @@ -35,8 +35,8 @@ - - + + + + + + + + + + @@ -88,30 +96,29 @@ http://activemq.apache.org/persistence.html --> - + - - - - - - - - - - - - - - --> + + + + + + + + + + + + - + + + <% if node['activemq']['enable_stomp'] -%> - + <% end -%> + + + + +