Don't assume pidfile location
When configuring the dir for the pidfiles in our init scripts don't assume the path is /var/run/$NAME. The defaults are now /var/run/nodepool now and could be set to other values as well. Instead of assuming /var/run/$NAME we instead take the dirname of $PIDFILE and configure whatever that dir is instead. Also expose zuulv3 flag to user to toggle the location of pidfile, this changes in nodepool > 0.5.0. Change-Id: I7fff2565f9e77d737c247f204925f66a0e4aabe8 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
e2b8c27908
commit
078f336a01
|
@ -33,6 +33,8 @@ USER=nodepool
|
||||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
PIDFILE_DIR=$(dirname $PIDFILE)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Function that starts the daemon/service
|
# Function that starts the daemon/service
|
||||||
#
|
#
|
||||||
|
@ -43,8 +45,10 @@ do_start()
|
||||||
# 1 if daemon was already running
|
# 1 if daemon was already running
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
|
|
||||||
mkdir -p /var/run/$NAME
|
if [ ! -d "$PIDFILE_DIR" ] ; then
|
||||||
chown $USER /var/run/$NAME
|
mkdir -p $PIDFILE_DIR
|
||||||
|
chown $USER $PIFILE_DIR
|
||||||
|
fi
|
||||||
ulimit -n 8192
|
ulimit -n 8192
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec $DAEMON --test > /dev/null \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec $DAEMON --test > /dev/null \
|
||||||
|| return 1
|
|| return 1
|
||||||
|
@ -69,7 +73,9 @@ do_stop()
|
||||||
start-stop-daemon --stop --signal 9 --pidfile $PIDFILE
|
start-stop-daemon --stop --signal 9 --pidfile $PIDFILE
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
[ "$RETVAL" = 2 ] && return 2
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
rm -f /var/run/$NAME/*
|
if [ -f "$PIDFILE" ] ; then
|
||||||
|
rm -f $PIDFILE
|
||||||
|
fi
|
||||||
return "$RETVAL"
|
return "$RETVAL"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +104,9 @@ do_graceful_stop()
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f /var/run/$NAME/*
|
if [ -f "$PIDFILE" ] ; then
|
||||||
|
rm -f $PIDFILE
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -22,6 +22,7 @@ class nodepool::builder(
|
||||||
$environment = {},
|
$environment = {},
|
||||||
$build_workers = '1',
|
$build_workers = '1',
|
||||||
$upload_workers = '4',
|
$upload_workers = '4',
|
||||||
|
$zuulv3 = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include ::diskimage_builder
|
include ::diskimage_builder
|
||||||
|
|
|
@ -5,4 +5,7 @@ export STATSD_PORT=8125
|
||||||
<% @environment.keys.sort.each do |key| -%>
|
<% @environment.keys.sort.each do |key| -%>
|
||||||
export <%= key %>='<%= @environment[key] %>'
|
export <%= key %>='<%= @environment[key] %>'
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
<% if @zuulv3 -%>
|
||||||
|
PIDFILE=/var/run/nodepool/nodepool-builder.pid
|
||||||
|
<% end -%>
|
||||||
DAEMON_ARGS="-c /etc/nodepool/nodepool.yaml -l /etc/nodepool/builder-logging.conf --build-workers <%= @build_workers %> --upload-workers <%= @upload_workers %>"
|
DAEMON_ARGS="-c /etc/nodepool/nodepool.yaml -l /etc/nodepool/builder-logging.conf --build-workers <%= @build_workers %> --upload-workers <%= @upload_workers %>"
|
||||||
|
|
Loading…
Reference in New Issue