Initial commit of zuul-executor
This is part of our zuulv3 effort. We want the ability to manage zuul-executor on a server. Change-Id: Iddac03a7187df47d2c72d957a50610f8b6a1dff5 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
84488919c6
commit
219e0d4644
49
files/executor-logging.conf
Normal file
49
files/executor-logging.conf
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
[loggers]
|
||||||
|
keys=root,zuul,gerrit,gear
|
||||||
|
|
||||||
|
[handlers]
|
||||||
|
keys=console,debug,normal
|
||||||
|
|
||||||
|
[formatters]
|
||||||
|
keys=simple
|
||||||
|
|
||||||
|
[logger_root]
|
||||||
|
level=WARNING
|
||||||
|
handlers=console
|
||||||
|
|
||||||
|
[logger_zuul]
|
||||||
|
level=DEBUG
|
||||||
|
handlers=debug,normal
|
||||||
|
qualname=zuul
|
||||||
|
|
||||||
|
[logger_gerrit]
|
||||||
|
level=INFO
|
||||||
|
handlers=debug,normal
|
||||||
|
qualname=gerrit
|
||||||
|
|
||||||
|
[logger_gear]
|
||||||
|
level=WARNING
|
||||||
|
handlers=debug,normal
|
||||||
|
qualname=gear
|
||||||
|
|
||||||
|
[handler_console]
|
||||||
|
level=WARNING
|
||||||
|
class=StreamHandler
|
||||||
|
formatter=simple
|
||||||
|
args=(sys.stdout,)
|
||||||
|
|
||||||
|
[handler_debug]
|
||||||
|
level=DEBUG
|
||||||
|
class=logging.handlers.WatchedFileHandler
|
||||||
|
formatter=simple
|
||||||
|
args=('/var/log/zuul/executor-debug.log',)
|
||||||
|
|
||||||
|
[handler_normal]
|
||||||
|
level=INFO
|
||||||
|
class=logging.handlers.WatchedFileHandler
|
||||||
|
formatter=simple
|
||||||
|
args=('/var/log/zuul/executor.log',)
|
||||||
|
|
||||||
|
[formatter_simple]
|
||||||
|
format=%(asctime)s %(levelname)s %(name)s: %(message)s
|
||||||
|
datefmt=
|
127
files/zuul-executor.init
Normal file
127
files/zuul-executor.init
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: zuul
|
||||||
|
# Required-Start: $remote_fs $syslog
|
||||||
|
# Required-Stop: $remote_fs $syslog
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: Zuul
|
||||||
|
# Description: Zuul Executor
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Do NOT "set -e"
|
||||||
|
|
||||||
|
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||||
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
|
||||||
|
DESC="Zuul Executor"
|
||||||
|
NAME=zuul-executor
|
||||||
|
DAEMON=/usr/local/bin/zuul-executor
|
||||||
|
PIDFILE=/var/run/$NAME/$NAME.pid
|
||||||
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
USER=zuul
|
||||||
|
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
|
# Read configuration variable file if it is present
|
||||||
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
|
||||||
|
# Load the VERBOSE setting and other rcS variables
|
||||||
|
. /lib/init/vars.sh
|
||||||
|
|
||||||
|
# Define LSB log_* functions.
|
||||||
|
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that starts the daemon/service
|
||||||
|
#
|
||||||
|
do_start()
|
||||||
|
{
|
||||||
|
# Return
|
||||||
|
# 0 if daemon has been started
|
||||||
|
# 1 if daemon was already running
|
||||||
|
# 2 if daemon could not be started
|
||||||
|
# 3 if pid file already exist
|
||||||
|
|
||||||
|
mkdir -p /var/run/$NAME
|
||||||
|
chown $USER /var/run/$NAME
|
||||||
|
ulimit -n 8192
|
||||||
|
if [ -f $PIDFILE ]; then
|
||||||
|
return 3
|
||||||
|
fi
|
||||||
|
start-stop-daemon \
|
||||||
|
--start --quiet --pidfile $PIDFILE -c $USER \
|
||||||
|
--exec $DAEMON --test > /dev/null || return 1
|
||||||
|
start-stop-daemon \
|
||||||
|
--start --quiet --pidfile $PIDFILE -c $USER \
|
||||||
|
--exec $DAEMON -- $DAEMON_ARGS || return 2
|
||||||
|
# Add code here, if necessary, that waits for the process to be ready
|
||||||
|
# to handle requests from services started subsequently which depend
|
||||||
|
# on this one. As a last resort, sleep for some time.
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that stops the daemon/service
|
||||||
|
#
|
||||||
|
do_stop()
|
||||||
|
{
|
||||||
|
$DAEMON stop
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that sends a SIGHUP to the daemon/service
|
||||||
|
#
|
||||||
|
do_reload() {
|
||||||
|
$DAEMON reconfigure
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||||
|
do_start
|
||||||
|
case "$?" in
|
||||||
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||||
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||||
|
3) echo "Pidfile at $PIDFILE already exists, run service zuul-executor stop to clean up."
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||||
|
do_stop
|
||||||
|
case "$?" in
|
||||||
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||||
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
|
;;
|
||||||
|
reload|force-reload)
|
||||||
|
#
|
||||||
|
# If do_reload() is not implemented then leave this commented out
|
||||||
|
# and leave 'force-reload' as an alias for 'restart'.
|
||||||
|
#
|
||||||
|
log_daemon_msg "Reloading $DESC" "$NAME"
|
||||||
|
do_reload
|
||||||
|
log_end_msg $?
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
#
|
||||||
|
# If the "reload" option is implemented then remove the
|
||||||
|
# 'force-reload' alias
|
||||||
|
#
|
||||||
|
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||||
|
do_stop
|
||||||
|
do_start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
||||||
|
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||||
|
exit 3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
:
|
72
manifests/executor.pp
Normal file
72
manifests/executor.pp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
# Copyright 2012-2013 Hewlett-Packard Development Company, L.P.
|
||||||
|
# Copyright 2014 OpenStack Foundation
|
||||||
|
# Copyright 2016 IBM Corp.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
# == Class: zuul::executor
|
||||||
|
#
|
||||||
|
class zuul::executor (
|
||||||
|
$ensure = undef,
|
||||||
|
$manage_log_conf = true,
|
||||||
|
) {
|
||||||
|
include ::apt
|
||||||
|
apt::ppa { 'ppa:openstack-ci-core/bubblewrap': }
|
||||||
|
|
||||||
|
package { 'bubblewrap':
|
||||||
|
ensure => present,
|
||||||
|
require => [
|
||||||
|
Apt::Ppa['ppa:openstack-ci-core/bubblewrap'],
|
||||||
|
Class['apt::update'],
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
service { 'zuul-executor':
|
||||||
|
ensure => $ensure,
|
||||||
|
name => 'zuul-executor',
|
||||||
|
enable => true,
|
||||||
|
hasrestart => true,
|
||||||
|
require => File['/etc/init.d/zuul-executor'],
|
||||||
|
}
|
||||||
|
|
||||||
|
if $manage_log_conf {
|
||||||
|
file { '/etc/zuul/executor-logging.conf':
|
||||||
|
ensure => present,
|
||||||
|
source => 'puppet:///modules/zuul/executor-logging.conf',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include ::logrotate
|
||||||
|
::logrotate::file { 'executor.log':
|
||||||
|
log => '/var/log/zuul/executor.log',
|
||||||
|
options => [
|
||||||
|
'compress',
|
||||||
|
'missingok',
|
||||||
|
'rotate 30',
|
||||||
|
'daily',
|
||||||
|
'notifempty',
|
||||||
|
],
|
||||||
|
require => Service['zuul-executor'],
|
||||||
|
}
|
||||||
|
::logrotate::file { 'executor-debug.log':
|
||||||
|
log => '/var/log/zuul/executor-debug.log',
|
||||||
|
options => [
|
||||||
|
'compress',
|
||||||
|
'missingok',
|
||||||
|
'rotate 30',
|
||||||
|
'daily',
|
||||||
|
'notifempty',
|
||||||
|
],
|
||||||
|
require => Service['zuul-executor'],
|
||||||
|
}
|
||||||
|
}
|
@ -402,6 +402,14 @@ class zuul (
|
|||||||
source => 'puppet:///modules/zuul/zuul-launcher.init',
|
source => 'puppet:///modules/zuul/zuul-launcher.init',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file { '/etc/init.d/zuul-executor':
|
||||||
|
ensure => present,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0555',
|
||||||
|
source => 'puppet:///modules/zuul/zuul-executor.init',
|
||||||
|
}
|
||||||
|
|
||||||
if $proxy_ssl_cert_file_contents == '' {
|
if $proxy_ssl_cert_file_contents == '' {
|
||||||
$ssl = false
|
$ssl = false
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user