group-based-policy/gbpservice/tests/contrib/devstack/lib/gbp

67 lines
2.0 KiB
Plaintext

# lib/gbp
# functions - functions specific to group-based-policy
# Dependencies:
# ``functions`` file
# ``DEST`` must be defined
# ``STACK_USER`` must be defined
# ``stack.sh`` calls the entry points in this order:
#
# - install_gbp
# - install_gbpclient
# - init_gbp
#
# ``unstack.sh`` calls the entry points in this order:
# Set up default directories
GBPSERVICE_DIR=$DEST/group-based-policy
GBPCLIENT_DIR=$DEST/python-gbpclient
GBPHEAT_DIR=$DEST/group-based-policy-automation
GBPUI_DIR=$DEST/group-based-policy-ui
NEUTRON_CONF_DIR=/etc/neutron
NEUTRON_CONF=$NEUTRON_CONF_DIR/neutron.conf
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Functions
# ---------
# init_gbpservice() - Initialize databases, etc.
function init_gbpservice {
# Run GBP db migrations
gbp-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
}
# install_gbpservice() - Collect source and prepare
function install_gbpservice {
mv $GBPSERVICE_DIR/test-requirements.txt $GBPSERVICE_DIR/_test-requirements.txt
pip_install -e $GBPSERVICE_DIR
#pip_install -e $GBP_DIR
#sed -i '/gbptestneutron/d' $GBPSERVICE_DIR/test-requirements.txt
#setup_develop $GBPSERVICE_DIR
\cp -rf $GBPSERVICE_DIR/etc/policy.json $Q_POLICY_FILE
sed -i 's/"context_is_admin": "role:admin"/"context_is_admin": "role:admin or user_name:neutron"/g' $Q_POLICY_FILE
mv $GBPSERVICE_DIR/_test-requirements.txt $GBPSERVICE_DIR/test-requirements.txt
}
# install_gbpclient() - Collect source and prepare
function install_gbpclient {
git_clone $GBPCLIENT_REPO $GBPCLIENT_DIR $GBPCLIENT_BRANCH
mv $GBPCLIENT_DIR/test-requirements.txt $GBPCLIENT_DIR/_test-requirements.txt
setup_develop $GBPCLIENT_DIR
sudo install -D -m 0644 -o $STACK_USER {$GBPCLIENT_DIR/tools/,/etc/bash_completion.d/}gbp.bash_completion
mv $GBPCLIENT_DIR/_test-requirements.txt $GBPCLIENT_DIR/test-requirements.txt
}
# Restore xtrace
$XTRACE
# Tell emacs to use shell-script-mode
## Local variables:
## mode: shell-script
## End: