Merge lp:~jhasaurabh/charms/precise/wildfly/trunk into lp:charms/wildfly

Proposed by saurabh
Status: Merged
Merged at revision: 9
Proposed branch: lp:~jhasaurabh/charms/precise/wildfly/trunk
Merge into: lp:charms/wildfly
Diff against target: 311 lines (+3/-293)
2 files modified
hooks/install (+3/-1)
templates/wildfly-init-debian.sh (+0/-292)
To merge this branch: bzr merge lp:~jhasaurabh/charms/precise/wildfly/trunk
Reviewer Review Type Date Requested Status
Matt Bruzek (community) Approve
Review via email: mp+241934@code.launchpad.net

Description of the change

Bug fix for Bug #1353651
https://bugs.launchpad.net/charms/+source/wildfly/+bug/1353651

Please review the changes and accept this merge proposal.

Thanks,
Saurabh

To post a comment you must log in.
10. By jhasaurabh <email address hidden>

Bug fix for bug #1353651

Revision history for this message
saurabh (jhasaurabh) wrote :

Hi,
Please consider the recent revision r10 for merging in the upstream repo.

Thanks,
Saurabh

Revision history for this message
Matt Bruzek (mbruzek) wrote :

Thank you for taking time to address this problem. The fix was tested on local LXC and Openstack and Power. This charm now works on Power hardware!

+1 LGTM

Thanks again!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/install'
2--- hooks/install 2014-02-16 14:30:53 +0000
3+++ hooks/install 2014-11-17 10:17:27 +0000
4@@ -22,7 +22,9 @@
5 rm -rf /tmp/wildfly-8.0.0.CR1.tar.gz
6 mv /opt/wildfly* /opt/wildfly
7 cat ${TMPL}/standalone.xml >/opt/wildfly/standalone/configuration/standalone.xml
8- cp ${TMPL}/wildfly-init-debian.sh /etc/init.d/wildfly
9+ cp /opt/wildfly/bin/init.d/wildfly.conf /etc/default/wildfly
10+ echo "JBOSS_USER=root" >>/etc/default/wildfly
11+ cp /opt/wildfly/bin/init.d/wildfly-init-debian.sh /etc/init.d/wildfly
12 chmod +x /etc/init.d/wildfly
13 else
14 echo "Download Incomplete, Terminating the charm deployment"
15
16=== removed file 'templates/wildfly-init-debian.sh'
17--- templates/wildfly-init-debian.sh 2014-02-16 14:30:53 +0000
18+++ templates/wildfly-init-debian.sh 1970-01-01 00:00:00 +0000
19@@ -1,292 +0,0 @@
20-#!/bin/sh
21-#
22-# /etc/init.d/wildfly -- startup script for WildFly
23-#
24-# Written by Jorge Solorzano <jorsol@gmail.com>
25-#
26-### BEGIN INIT INFO
27-# Provides: wildfly
28-# Required-Start: $remote_fs $network
29-# Required-Stop: $remote_fs $network
30-# Should-Start: $named
31-# Should-Stop: $named
32-# Default-Start: 2 3 4 5
33-# Default-Stop: 0 1 6
34-# Short-Description: WildFly Application Server
35-# Description: Provide WildFly startup/shutdown script
36-### END INIT INFO
37-
38-NAME=wildfly
39-DESC="WildFly Application Server"
40-DEFAULT=/etc/default/$NAME
41-JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
42-JBOSS_HOME="/opt/wildfly"
43-# Check privileges
44-if [ `id -u` -ne 0 ]; then
45- echo "You need root privileges to run this script"
46- exit 1
47-fi
48-
49-# Make sure wildfly is started with system locale
50-if [ -r /etc/default/locale ]; then
51- . /etc/default/locale
52- export LANG
53-fi
54-
55-. /lib/lsb/init-functions
56-
57-if [ -r /etc/default/rcS ]; then
58- . /etc/default/rcS
59-fi
60-
61-# Overwrite settings from default file
62-if [ -f "$DEFAULT" ]; then
63- . "$DEFAULT"
64-fi
65-
66-# Location of jdk
67-if [ -n "$JAVA_HOME" ]; then
68- JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
69-fi
70-export JAVA_HOME
71-# Setup the JVM
72-if [ "x$JAVA" = "x" ]; then
73- if [ "x$JAVA_HOME" != "x" ]; then
74- JAVA="$JAVA_HOME/bin/java"
75- else
76- JAVA="java"
77- fi
78-fi
79-
80-# Location of wildfly
81-if [ -z "$JBOSS_HOME" ]; then
82- JBOSS_HOME=/opt/wildfly
83-fi
84-export JBOSS_HOME
85-
86-# Check if wildfly is installed
87-if [ ! -f "$JBOSS_HOME/jboss-modules.jar" ]; then
88- log_failure_msg "$NAME is not installed in $JBOSS_HOME"
89- exit 1
90-fi
91-
92-# Run as wildfly user
93-if [ -z "$JBOSS_USER" ]; then
94- JBOSS_USER=root
95-fi
96-
97-# Check wildfly user
98-id $JBOSS_USER > /dev/null 2>&1
99-if [ $? -ne 0 -o -z "$JBOSS_USER" ]; then
100- log_failure_msg "User $JBOSS_USER does not exist..."
101- exit 1
102-fi
103-
104-# Startup mode of wildfly
105-if [ -z "$JBOSS_MODE" ]; then
106- JBOSS_MODE=standalone
107-fi
108-
109-# Startup mode script
110-if [ "$JBOSS_MODE" = "standalone" ]; then
111- JBOSS_SCRIPT=$JBOSS_HOME/bin/standalone.sh
112- if [ -z "$JBOSS_CONFIG" ]; then
113- JBOSS_CONFIG=standalone.xml
114- fi
115-else
116- JBOSS_SCRIPT=$JBOSS_HOME/bin/domain.sh
117- if [ -z "$JBOSS_DOMAIN_CONFIG" ]; then
118- JBOSS_DOMAIN_CONFIG=domain.xml
119- fi
120- if [ -z "$JBOSS_HOST_CONFIG" ]; then
121- JBOSS_HOST_CONFIG=host.xml
122- fi
123-fi
124-
125-# Check startup file
126-if [ ! -x $JBOSS_SCRIPT ]; then
127- log_failure_msg "$JBOSS_SCRIPT is not an executable!"
128- exit 1
129-fi
130-
131-# Check cli file
132-JBOSS_CLI=$JBOSS_HOME/bin/jboss-cli.sh
133-if [ ! -x $JBOSS_CLI ]; then
134- log_failure_msg "$JBOSS_CLI is not an executable!"
135- exit 1
136-fi
137-
138-# The amount of time to wait for startup
139-if [ -z "$STARTUP_WAIT" ]; then
140- STARTUP_WAIT=30
141-fi
142-
143-# The amount of time to wait for shutdown
144-if [ -z "$SHUTDOWN_WAIT" ]; then
145- SHUTDOWN_WAIT=30
146-fi
147-
148-# Location to keep the console log
149-if [ -z "$JBOSS_CONSOLE_LOG" ]; then
150- JBOSS_CONSOLE_LOG=/var/log/$NAME/console.log
151-fi
152-export JBOSS_CONSOLE_LOG
153-
154-# Location to set the pid file
155-JBOSS_PIDFILE=/var/run/$NAME/$NAME.pid
156-export JBOSS_PIDFILE
157-
158-# Launch wildfly in background
159-LAUNCH_JBOSS_IN_BACKGROUND=1
160-export LAUNCH_JBOSS_IN_BACKGROUND
161-
162-# Helper function to check status of wildfly service
163-check_status() {
164- pidofproc -p $JBOSS_PIDFILE $JAVA >/dev/null 2>&1
165-}
166-
167-case "$1" in
168- start)
169- log_daemon_msg "Starting $DESC" "$NAME"
170- check_status
171- status_start=$?
172- if [ $status_start -eq 3 ]; then
173- mkdir -p $(dirname $JBOSS_PIDFILE)
174- mkdir -p $(dirname $JBOSS_CONSOLE_LOG)
175- chown $JBOSS_USER $(dirname $JBOSS_PIDFILE) || true
176- cat /dev/null > $JBOSS_CONSOLE_LOG
177-
178- if [ "$JBOSS_MODE" = "standalone" ]; then
179- start-stop-daemon --start --user "$JBOSS_USER" \
180- --chuid "$JBOSS_USER" --chdir "$JBOSS_HOME" --pidfile "$JBOSS_PIDFILE" \
181- --exec "$JBOSS_SCRIPT" -- -c $JBOSS_CONFIG >> $JBOSS_CONSOLE_LOG 2>&1 &
182- else
183- start-stop-daemon --start --user "$JBOSS_USER" \
184- --chuid "$JBOSS_USER" --chdir "$JBOSS_HOME" --pidfile "$JBOSS_PIDFILE" \
185- --exec "$JBOSS_SCRIPT" -- --domain-config=$JBOSS_DOMAIN_CONFIG \
186- --host-config=$JBOSS_HOST_CONFIG >> $JBOSS_CONSOLE_LOG 2>&1 &
187- fi
188-
189- count=0
190- launched=0
191- until [ $count -gt $STARTUP_WAIT ]
192- do
193- grep 'JBAS015874:' $JBOSS_CONSOLE_LOG > /dev/null
194- if [ $? -eq 0 ] ; then
195- launched=1
196- break
197- fi
198- sleep 1
199- count=$((count + 1));
200- done
201-
202- if check_status; then
203- log_end_msg 0
204- else
205- log_end_msg 1
206- fi
207-
208- if [ $launched -eq 0 ]; then
209- log_warning_msg "$DESC hasn't started within the timeout allowed"
210- log_warning_msg "please review file $JBOSS_CONSOLE_LOG to see the status of the service"
211- fi
212- elif [ $status_start -eq 1 ]; then
213- log_failure_msg "$DESC is not running but the pid file exists"
214- exit 1
215- elif [ $status_start -eq 0 ]; then
216- log_success_msg "$DESC (already running)"
217- fi
218- ;;
219- stop)
220- check_status
221- status_stop=$?
222- if [ $status_stop -eq 0 ]; then
223- read kpid < $JBOSS_PIDFILE
224- log_daemon_msg "Stopping $DESC" "$NAME"
225-
226- start-stop-daemon --start --chuid "$JBOSS_USER" \
227- --exec "$JBOSS_CLI" -- --connect --command=:shutdown \
228- >/dev/null 2>&1
229-
230- if [ $? -eq 1 ]; then
231- kill -15 $kpid
232- fi
233-
234- count=0
235- until [ $count -gt $SHUTDOWN_WAIT ]
236- do
237- check_status
238- if [ $? -eq 3 ]; then
239- break
240- fi
241- sleep 1
242- count=$((count + 1));
243- done
244-
245- if [ $count -gt $SHUTDOWN_WAIT ]; then
246- kill -9 $kpid
247- fi
248-
249- log_end_msg 0
250- elif [ $status_stop -eq 1 ]; then
251- log_action_msg "$DESC is not running but the pid file exists, cleaning up"
252- rm -f $JBOSS_PIDFILE
253- elif [ $status_stop -eq 3 ]; then
254- log_action_msg "$DESC is not running"
255- fi
256- ;;
257- restart)
258- check_status
259- status_restart=$?
260- if [ $status_restart -eq 0 ]; then
261- $0 stop
262- fi
263- $0 start
264- ;;
265- reload|force-reload)
266- check_status
267- status_reload=$?
268- if [ $status_reload -eq 0 ]; then
269- log_daemon_msg "Reloading $DESC config" "$NAME"
270-
271- if [ "$JBOSS_MODE" = "standalone" ]; then
272- RELOAD_CMD=":reload"; else
273- RELOAD_CMD=":reload-servers"; fi
274-
275- start-stop-daemon --start --chuid "$JBOSS_USER" \
276- --exec "$JBOSS_CLI" -- --connect --command=$RELOAD_CMD >/dev/null 2>&1
277-
278- if [ $? -eq 0 ]; then
279- log_end_msg 0
280- else
281- log_end_msg 1
282- fi
283- else
284- log_failure_msg "$DESC is not running"
285- fi
286- ;;
287- status)
288- check_status
289- status=$?
290- if [ $status -eq 0 ]; then
291- read pid < $JBOSS_PIDFILE
292- log_action_msg "$DESC is running with pid $pid"
293- exit 0
294- elif [ $status -eq 1 ]; then
295- log_action_msg "$DESC is not running and the pid file exists"
296- exit 1
297- elif [ $status -eq 3 ]; then
298- log_action_msg "$DESC is not running"
299- exit 3
300- else
301- log_action_msg "Unable to determine $NAME status"
302- exit 4
303- fi
304- ;;
305- *)
306- log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload|status}"
307- exit 2
308- ;;
309-esac
310-
311-exit 0

Subscribers

People subscribed via source and target branches

to all changes: