819518d464
There was duplication between base and target dumps that is resolved by use of arguments. By extracting to function it becomes easier to make changes to how database dumps are performed. The current setup is a bit hairy, aggregating in a function makes it easier to improve later. Change-Id: Ic5d4f13eaa7a4d842c9af0073de17e1cffad0a88
57 lines
1.5 KiB
Bash
Executable File
57 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# ``save-state``
|
|
|
|
echo "*********************************************************************"
|
|
echo "Begin $0"
|
|
echo "*********************************************************************"
|
|
|
|
# Clean up any resources that may be in use
|
|
cleanup() {
|
|
set +o errexit
|
|
|
|
echo "*********************************************************************"
|
|
echo "ERROR: Abort $0"
|
|
echo "*********************************************************************"
|
|
|
|
# Kill ourselves to signal any calling process
|
|
trap 2; kill -2 $$
|
|
}
|
|
|
|
# Keep track of the grenade directory
|
|
GRENADE_DIR=$(cd $(dirname "$0") && pwd)
|
|
|
|
# Import common functions
|
|
source $GRENADE_DIR/functions
|
|
|
|
# Determine what system we are running on. This provides ``os_VENDOR``,
|
|
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
|
|
# and ``DISTRO``
|
|
GetDistro
|
|
|
|
# Source params
|
|
source $GRENADE_DIR/grenaderc
|
|
|
|
# For debugging
|
|
set -o xtrace
|
|
|
|
|
|
# Save databases
|
|
# --------------
|
|
|
|
save_data $BASE_RELEASE $BASE_DEVSTACK_DIR
|
|
|
|
# Save ebtables/iptables
|
|
# ----------------------
|
|
|
|
sudo iptables-save >$SAVE_DIR/iptables.$BASE_RELEASE
|
|
sudo ebtables -t broute -L >$SAVE_DIR/ebtables-broute.$BASE_RELEASE
|
|
sudo ebtables -t filter -L >$SAVE_DIR/ebtables-filter.$BASE_RELEASE
|
|
sudo ebtables -t nat -L >$SAVE_DIR/ebtables-nat.$BASE_RELEASE
|
|
|
|
|
|
set +o xtrace
|
|
echo "*********************************************************************"
|
|
echo "SUCCESS: End $0"
|
|
echo "*********************************************************************"
|