Enforce function declaration format in bash8
Check that function calls look like ^function foo {$ in bash8, and fix
all existing failures of that check. Add a note to HACKING.rst
Change-Id: Ic19eecb39e0b20273d1bcd551a42fe400d54e938
diff --git a/lib/neutron_thirdparty/bigswitch_floodlight b/lib/neutron_thirdparty/bigswitch_floodlight
index 24c1044..f03de56 100644
--- a/lib/neutron_thirdparty/bigswitch_floodlight
+++ b/lib/neutron_thirdparty/bigswitch_floodlight
@@ -8,11 +8,11 @@
BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80}
BS_FL_OF_PORT=${BS_FL_OF_PORT:-6633}
-function configure_bigswitch_floodlight() {
+function configure_bigswitch_floodlight {
:
}
-function init_bigswitch_floodlight() {
+function init_bigswitch_floodlight {
install_neutron_agent_packages
echo -n "Installing OVS managed by the openflow controllers:"
@@ -32,19 +32,19 @@
sudo ovs-vsctl --no-wait set-controller ${OVS_BRIDGE} ${ctrls}
}
-function install_bigswitch_floodlight() {
+function install_bigswitch_floodlight {
:
}
-function start_bigswitch_floodlight() {
+function start_bigswitch_floodlight {
:
}
-function stop_bigswitch_floodlight() {
+function stop_bigswitch_floodlight {
:
}
-function check_bigswitch_floodlight() {
+function check_bigswitch_floodlight {
:
}
diff --git a/lib/neutron_thirdparty/midonet b/lib/neutron_thirdparty/midonet
index 98be425..ad417bb 100644
--- a/lib/neutron_thirdparty/midonet
+++ b/lib/neutron_thirdparty/midonet
@@ -20,28 +20,28 @@
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
-function configure_midonet() {
+function configure_midonet {
:
}
-function init_midonet() {
+function init_midonet {
:
}
-function install_midonet() {
+function install_midonet {
git_clone $MIDONET_CLIENT_REPO $MIDONET_CLIENT_DIR $MIDONET_CLIENT_BRANCH
export PYTHONPATH=$MIDONET_CLIENT_DIR/src:$PYTHONPATH
}
-function start_midonet() {
+function start_midonet {
:
}
-function stop_midonet() {
+function stop_midonet {
:
}
-function check_midonet() {
+function check_midonet {
:
}
diff --git a/lib/neutron_thirdparty/ryu b/lib/neutron_thirdparty/ryu
index 5edf273..424a900 100644
--- a/lib/neutron_thirdparty/ryu
+++ b/lib/neutron_thirdparty/ryu
@@ -21,14 +21,14 @@
# configure_ryu can be called multiple times as neutron_pluing/ryu may call
# this function for neutron-ryu-agent
_RYU_CONFIGURED=${_RYU_CONFIGURED:-False}
-function configure_ryu() {
+function configure_ryu {
if [[ "$_RYU_CONFIGURED" == "False" ]]; then
setup_develop $RYU_DIR
_RYU_CONFIGURED=True
fi
}
-function init_ryu() {
+function init_ryu {
RYU_CONF_DIR=/etc/ryu
if [[ ! -d $RYU_CONF_DIR ]]; then
sudo mkdir -p $RYU_CONF_DIR
@@ -60,22 +60,22 @@
# Make this function idempotent and avoid cloning same repo many times
# with RECLONE=yes
_RYU_INSTALLED=${_RYU_INSTALLED:-False}
-function install_ryu() {
+function install_ryu {
if [[ "$_RYU_INSTALLED" == "False" ]]; then
git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH
_RYU_INSTALLED=True
fi
}
-function start_ryu() {
+function start_ryu {
screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --config-file $RYU_CONF"
}
-function stop_ryu() {
+function stop_ryu {
:
}
-function check_ryu() {
+function check_ryu {
:
}
diff --git a/lib/neutron_thirdparty/trema b/lib/neutron_thirdparty/trema
index 2b12564..d465ac7 100644
--- a/lib/neutron_thirdparty/trema
+++ b/lib/neutron_thirdparty/trema
@@ -31,7 +31,7 @@
TREMA_SS_APACHE_CONFIG=/etc/apache2/sites-available/sliceable_switch.conf
# configure_trema - Set config files, create data dirs, etc
-function configure_trema() {
+function configure_trema {
# prepare dir
for d in $TREMA_SS_ETC_DIR $TREMA_SS_DB_DIR $TREMA_SS_SCRIPT_DIR; do
sudo mkdir -p $d
@@ -41,7 +41,7 @@
}
# init_trema - Initialize databases, etc.
-function init_trema() {
+function init_trema {
local _pwd=$(pwd)
# Initialize databases for Sliceable Switch
@@ -70,7 +70,7 @@
$TREMA_SS_CONFIG
}
-function gem_install() {
+function gem_install {
[[ "$OFFLINE" = "True" ]] && return
[ -n "$RUBYGEMS_CMD" ] || get_gem_command
@@ -79,7 +79,7 @@
sudo $RUBYGEMS_CMD install $pkg
}
-function get_gem_command() {
+function get_gem_command {
# Trema requires ruby 1.8, so gem1.8 is checked first
RUBYGEMS_CMD=$(which gem1.8 || which gem)
if [ -z "$RUBYGEMS_CMD" ]; then
@@ -87,7 +87,7 @@
fi
}
-function install_trema() {
+function install_trema {
# Trema
gem_install trema
# Sliceable Switch
@@ -97,7 +97,7 @@
make -C $TREMA_DIR/apps/sliceable_switch
}
-function start_trema() {
+function start_trema {
# APACHE_NAME is defined in init_horizon (in lib/horizon)
restart_service $APACHE_NAME
@@ -105,11 +105,11 @@
trema run -d -c $TREMA_SS_CONFIG
}
-function stop_trema() {
+function stop_trema {
sudo TREMA_TMP=$TREMA_TMP_DIR trema killall
}
-function check_trema() {
+function check_trema {
:
}
diff --git a/lib/neutron_thirdparty/vmware_nsx b/lib/neutron_thirdparty/vmware_nsx
index 4eb177a..3fecc62 100644
--- a/lib/neutron_thirdparty/vmware_nsx
+++ b/lib/neutron_thirdparty/vmware_nsx
@@ -22,11 +22,11 @@
# is invoked by unstack.sh
FLOATING_RANGE=${FLOATING_RANGE:-172.24.4.0/24}
-function configure_vmware_nsx() {
+function configure_vmware_nsx {
:
}
-function init_vmware_nsx() {
+function init_vmware_nsx {
if ! is_set NSX_GATEWAY_NETWORK_CIDR; then
NSX_GATEWAY_NETWORK_CIDR=$PUBLIC_NETWORK_GATEWAY/${FLOATING_RANGE#*/}
echo "The IP address to set on br-ex was not specified. "
@@ -52,15 +52,15 @@
sudo ip addr add dev $PUBLIC_BRIDGE $NSX_GATEWAY_NETWORK_CIDR
}
-function install_vmware_nsx() {
+function install_vmware_nsx {
:
}
-function start_vmware_nsx() {
+function start_vmware_nsx {
:
}
-function stop_vmware_nsx() {
+function stop_vmware_nsx {
if ! is_set NSX_GATEWAY_NETWORK_CIDR; then
NSX_GATEWAY_NETWORK_CIDR=$PUBLIC_NETWORK_GATEWAY/${FLOATING_RANGE#*/}
echo "The IP address expected on br-ex was not specified. "
@@ -78,7 +78,7 @@
done
}
-function check_vmware_nsx() {
+function check_vmware_nsx {
neutron-check-nsx-config $NEUTRON_CONF_DIR/plugins/vmware/nsx.ini
}