Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Various Fixes #8

Merged
merged 2 commits into from

4 participants

@Atalanta

Cloned your repo and ran vagrant up.

Various issues in the ark recipe and the default_tomcat template fixed.

Stephen Nels... added some commits
Stephen Nelson-Smith Fix: Various issues in ark recipe
- Directory resource needed
- Service name precalculated
- Update resource notification syntax
- Ordering of service
993ac65
Stephen Nelson-Smith Fix: Template / Hash Syntax Problems
- In several places, Hash values are attempted to be called using dot notation
  rather than strings, which cause breakages.  Changes to strings.
- When calculating whether the hash has a JMX password, use has_key
8b40558
@bryanwb bryanwb merged commit 4acbe18 into bryanwb:master
@martinei

I think this breakes the tomcat lwrp which does:
variables(:tomcat => new_resource)
since new_resource is not a hash.

This commit also changes the usage of the jmx_opts. They were not previously added to JAVA_OPTS, and they should not be. This becomes a problem when the init.d tomcat script tries to 'stop' tomcat since JAVA_OPTS are used for that command. This then causes the issue described here: https://bowerstudios.com/node/636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 6, 2013
  1. Fix: Various issues in ark recipe

    Stephen Nelson-Smith authored
    - Directory resource needed
    - Service name precalculated
    - Update resource notification syntax
    - Ordering of service
  2. Fix: Template / Hash Syntax Problems

    Stephen Nelson-Smith authored
    - In several places, Hash values are attempted to be called using dot notation
      rather than strings, which cause breakages.  Changes to strings.
    - When calculating whether the hash has a JMX password, use has_key
This page is out of date. Refresh to see the latest.
Showing with 38 additions and 29 deletions.
  1. +16 −12 recipes/ark.rb
  2. +22 −17 templates/default/default_tomcat.erb
View
28 recipes/ark.rb
@@ -21,6 +21,7 @@
include_recipe "ark"
version = node['tomcat']['version'].to_s
+tomcat_version = "tomcat#{node['tomcat']['version'].to_s}"
distro = "debian"
# the sysv init script requires an additional package
@@ -30,7 +31,11 @@
user node['tomcat']['user']
-ark "tomcat#{version}" do
+directory "/usr/local/tomcat" do
+ owner node['tomcat']['user']
+end
+
+ark tomcat_version do
url node['tomcat'][version]['url']
checksum node['tomcat'][version]['checksum']
version node['tomcat']['version']
@@ -39,27 +44,26 @@
owner node['tomcat']['user']
end
-template "tomcat#{version}" do
- path "/etc/init.d/tomcat#{version}"
+init_script = template tomcat_version do
+ path "/etc/init.d/#{tomcat_version}"
source "tomcat.init.#{distro}.erb"
owner "root"
group "root"
mode "0774"
- variables( :name => "tomcat#{version}")
- notifies :restart, resources(:service => "tomcat")
+ variables( :name => tomcat_version)
+end
+
+service tomcat_version do
+ supports :restart => true, :reload => true, :status => true
+ action [:enable, :start]
end
-template "/etc/default/tomcat#{version}" do
+template "/etc/default/#{tomcat_version}" do
source "default_tomcat.erb"
owner "root"
group "root"
variables(:tomcat => node['tomcat'].to_hash)
mode "0644"
- notifies :restart, resources(:service => "tomcat")
+ notifies :restart, "service[#{tomcat_version}]", :immediately
end
-service "tomcat" do
- service_name "tomcat#{version}"
- supports :restart => true, :reload => true, :status => true
- action [:enable, :start]
-end
View
39 templates/default/default_tomcat.erb
@@ -4,30 +4,35 @@
# Local modifications will be overwritten by Chef.
#
-
-SHUTDOWN_WAIT=<%= @tomcat.shutdown_wait %>
-TOMCAT_USER=<%= @tomcat.user %>
-TOMCAT_GROUP=<%= @tomcat.user %>
+SHUTDOWN_WAIT=<%= @tomcat["shutdown_wait"] %>
+TOMCAT_USER=<%= @tomcat["user"] %>
+TOMCAT_GROUP=<%= @tomcat["group"] %>
JAVA_HOME=<%= node["java"]["java_home"] %>
-CATALINA_HOME=<%= node['tomcat']['home'] %>
-CATALINA_BASE=<%= @tomcat.base %>
-CATALINA_PID="/var/run/<%= @tomcat.params["pid_file"] %>"
-JAVA_OPTS="<%= @tomcat.jvm_opts.join(' ') +
- @tomcat.webapp_opts.join(' ') + " " +
- @tomcat.more_opts.join(' ') %>"
-JMX_OPTS="<%= @tomcat.jmx_opts.join(' ') %> "
-<% unless @tomcat.jmx_password.empty? -%>
-JMX_OPTS=$JMX_OPTS" <%= "-Dcom.sun.management.jmxremote.access.file=#{@tomcat.jmx_access_file} " %> "
-JMX_OPTS=$JMX_OPTS" <%= "-Dcom.sun.management.jmxremote.password.file=#{@tomcat.jmx_password_file} " %> "
+CATALINA_HOME=<%= @tomcat["home"] %>
+CATALINA_BASE=<%= @tomcat["base"] %>
+CATALINA_PID="/var/run/<%= @tomcat["pid_file"] %>"
+
+JAVA_OPTS="<%= @tomcat['jvm_opts'].join(' ') +
+ @tomcat['jmx_opts'].join(' ') + " " +
+ @tomcat['webapp_opts'].join(' ') + " " +
+ @tomcat['more_opts'].join(' ') %>"
+
+<% unless @tomcat.has_key?("jmx_password") -%>
+JMX_OPTS=$JMX_OPTS" <%= "-Dcom.sun.management.jmxremote.access.file=#{@tomcat["jmx_access_file"]} " %> "
+JMX_OPTS=$JMX_OPTS" <%= "-Dcom.sun.management.jmxremote.password.file=#{@tomcat["jmx_password_file"]} " %> "
<% end -%>
-<% @tomcat.env.each do |envvar| -%>
+
+<% if @tomcat['env'] -%>
+<% @tomcat['env'].each do |envvar| -%>
export <%= envvar %>
<% end -%>
+<% end -%>
JAVA_ENDORSED_DIRS="$CATALINA_HOME/endorsed"
# Use the Java security manager? (yes/no, default: no)
-TOMCAT6_SECURITY=<%= @tomcat.params["use_security_manager"] ? "yes" : "no" %>
+TOMCAT6_SECURITY=<%= @tomcat["use_security_manager"] ? "yes" : "no" %>
+
+CATALINA_TMPDIR=<%= @tomcat["tmp_dir"] %>
-CATALINA_TMPDIR=<%= @tomcat.params["tmp_dir"] %>
Something went wrong with that request. Please try again.