- Add config validation to rc script

- Fix broken CLI
- Update env file with current defaults
- Bump PORTREVISION
This commit is contained in:
Ryan Steinmetz 2019-01-15 17:43:31 +00:00
parent 5b0da79904
commit dae7791154
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=490392
4 changed files with 51 additions and 24 deletions

View file

@ -3,6 +3,7 @@
PORTNAME= exabgp
PORTVERSION= 3.4.25
PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= GH \
ZI

View file

@ -1,6 +1,19 @@
[exabgp.api]
encoder = text
highres = false
respawn = false
socket = ''
[exabgp.bgp]
openwait = 60
[exabgp.cache]
attributes = true
nexthops = true
[exabgp.daemon]
daemonize = true
drop = true
pid = '/var/run/exabgp/exabgp.pid'
user = '_bgpd'
@ -16,10 +29,10 @@ network = true
packets = false
parser = false
processes = true
reactor = true
rib = false
routes = false
short = false
supervisor = true
timers = false
[exabgp.pdb]
@ -29,5 +42,12 @@ enable = false
enable = false
file = ''
[exabgp.reactor]
speed = 1.0
[exabgp.tcp]
timeout = 1
acl = false
bind = ''
delay = 0
once = false
port = 179

View file

@ -24,34 +24,40 @@ pidfile=/var/run/${name}/${name}.pid
required_files=${exabgp_conf}
command="%%PYTHON_SITELIBDIR%%/${name}/application/bgp.py"
procname="%%PYTHON_CMD%%"
command="%%PYTHON_CMD%%"
command_args="-m exabgp --folder /usr/local/etc/exabgp ${exabgp_conf}"
start_cmd="exabgp_start"
configtest_cmd="exabgp_configtest"
start_precmd="exabgp_precmd"
reload_precmd="exabgp_configtest"
restart_precmd="exabgp_configtest"
reload_all_cmd="exabgp_reload_all"
extra_commands="reload reload_all"
reload_all_precmd="exabgp_configtest"
extra_commands="configtest reload reload_all"
sig_reload="USR1"
exabgp_start()
{
if [ -z "$rc_fast" -a -n "$rc_pid" ]; then
echo 1>&2 "${name} already running? (pid=$rc_pid)."
return 1
fi
echo "Starting ${name}."
install -d -o _bgpd -g _bgpd -m 755 /var/run/${name}
install -d -o _bgpd -g _bgpd -m 755 /var/log/${name}
rm -f ${pidfile}
${procname} ${command} --folder %%ETCDIR%% ${exabgp_conf}
}
exabgp_reload_all()
{
echo "Reloading exabgp configuration and processes."
kill -USR2 $rc_pid
}
exabgp_configtest()
{
echo "Performing sanity check on ${name} configuration."
result=$(env exabgp.log.configuration=true exabgp.daemon.daemonize=false exabgp.log.level=ERR exabgp.log.destination=stdout ${command} -m ${name} --folder /usr/local/etc/exabgp -t ${exabgp_conf} 2>&1)
if [ ! -z "${result}" ]; then
echo "${result}"
err 1 "Failed to validate configuration file, aborting."
fi
}
exabgp_precmd()
{
exabgp_configtest
install -d -o _bgpd -g _bgpd -m 755 /var/run/${name}
install -d -o _bgpd -g _bgpd -m 755 /var/log/${name}
rm -f ${pidfile}
}
run_rc_command "$1"

View file

@ -8,9 +8,9 @@ APPLICATIONS=`$INTERPRETER -c "import sys,os; print ' '.join(os.path.join(_,'exa
APPLICATION=`echo $APPLICATIONS | awk '{ print $1; }'`
if [ $# -eq 0 ]; then
$INTERPRETER -m exabgp.debug $APPLICATION --folder %%PREFIX%%/etc/exabgp --help
$INTERPRETER -m exabgp $APPLICATION --folder %%PREFIX%%/etc/exabgp --help
echo "===> To start exabgp, you should use:"
echo "===> service exabgp start"
else
exec $INTERPRETER -m exabgp.debug $APPLICATION --folder %%PREFIX%%/etc/exabgp $*
exec $INTERPRETER -m exabgp $APPLICATION --folder %%PREFIX%%/etc/exabgp $*
fi