Support the possibility of using entry-points.

If console scripts are generated via entry-points, they will go into
/usr/local/bin on python setup.py develop and they will not be found in
/opt/stack/$PROJECT/bin any more. This patch supports a transition to
entry-points console scripts, but should still allow the old thing too.

Change-Id: I816f5f796ad00ac55a8352743ba01723df140072
This commit is contained in:
Monty Taylor 2012-08-17 12:52:27 -04:00
parent 555767abbf
commit 9fbeeddc3b
4 changed files with 40 additions and 19 deletions

View File

@ -75,7 +75,10 @@ OVS_HOSTS=${DEFAULT_OVS_HOSTS:-"localhost"}
#------------------------------------------------------------------------------
# Nova settings.
#------------------------------------------------------------------------------
NOVA_MANAGE=/opt/stack/nova/bin/nova-manage
if [ -f /opt/stack/nova/bin/nova-manage ] ; then
NOVA_MANAGE=/opt/stack/nova/bin/nova-manage
else
NOVA_MANAGE=/usr/local/bin/nova-manage
NOVA=/usr/local/bin/nova
NOVA_CONF=/etc/nova/nova.conf

View File

@ -23,6 +23,12 @@ set -o xtrace
# set up default directories
CEILOMETER_DIR=$DEST/ceilometer
# Support potential entry-points console scripts
if [ -d $CEILOMETER_DIR/bin ] ; then
CEILOMETER_BIN_DIR=$CEILOMETER_DIR/bin
else
CEILOMETER_BIN_DIR=/usr/local/bin
fi
CEILOMETER_CONF_DIR=/etc/ceilometer
CEILOMETER_AGENT_CONF=$CEILOMETER_CONF_DIR/ceilometer-agent.conf
CEILOMETER_COLLECTOR_CONF=$CEILOMETER_CONF_DIR/ceilometer-collector.conf
@ -54,7 +60,7 @@ function install_ceilometer() {
# start_ceilometer() - Start running processes, including screen
function start_ceilometer() {
screen_it ceilometer-acompute "cd $CEILOMETER_DIR && $CEILOMETER_DIR/bin/ceilometer-agent-compute --config-file $CEILOMETER_AGENT_CONF"
screen_it ceilometer-acentral "cd $CEILOMETER_DIR && $CEILOMETER_DIR/bin/ceilometer-agent-central --config-file $CEILOMETER_AGENT_CONF"
screen_it ceilometer-collector "cd $CEILOMETER_DIR && $CEILOMETER_DIR/bin/ceilometer-collector --config-file $CEILOMETER_COLLECTOR_CONF"
screen_it ceilometer-acompute "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_AGENT_CONF"
screen_it ceilometer-acentral "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_AGENT_CONF"
screen_it ceilometer-collector "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-collector --config-file $CEILOMETER_COLLECTOR_CONF"
}

View File

@ -25,6 +25,11 @@ set -o xtrace
# set up default directories
CINDER_DIR=$DEST/cinder
if [ -d $CINDER_DIR/bin ] ; then
CINDER_BIN_DIR=$CINDER_DIR/bin
else
CINDER_BIN_DIR=/usr/local/bin
fi
CINDERCLIENT_DIR=$DEST/python-cinderclient
CINDER_CONF_DIR=/etc/cinder
CINDER_CONF=$CINDER_CONF_DIR/cinder.conf
@ -134,7 +139,7 @@ function init_cinder() {
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE cinder;'
# (re)create cinder database
$CINDER_DIR/bin/cinder-manage db sync
$CINDER_BIN_DIR/cinder-manage db sync
fi
if is_service_enabled c-vol; then
@ -198,9 +203,9 @@ function start_cinder() {
fi
fi
screen_it c-api "cd $CINDER_DIR && $CINDER_DIR/bin/cinder-api --config-file $CINDER_CONF"
screen_it c-vol "cd $CINDER_DIR && $CINDER_DIR/bin/cinder-volume --config-file $CINDER_CONF"
screen_it c-sch "cd $CINDER_DIR && $CINDER_DIR/bin/cinder-scheduler --config-file $CINDER_CONF"
screen_it c-api "cd $CINDER_DIR && $CINDER_BIN_DIR/cinder-api --config-file $CINDER_CONF"
screen_it c-vol "cd $CINDER_DIR && $CINDER_BIN_DIR/cinder-volume --config-file $CINDER_CONF"
screen_it c-sch "cd $CINDER_DIR && $CINDER_BIN_DIR/cinder-scheduler --config-file $CINDER_CONF"
}
# stop_cinder() - Stop running processes (non-screen)

View File

@ -1760,6 +1760,13 @@ elif is_service_enabled n-vol; then
fi
fi
# Support entry points installation of console scripts
if [ -d $NOVA_DIR/bin ] ; then
NOVA_BIN_DIR=$NOVA_DIR/bin
else
NOVA_BIN_DIR=/usr/local/bin
fi
NOVA_CONF=nova.conf
function add_nova_opt {
echo "$1" >> $NOVA_CONF_DIR/$NOVA_CONF
@ -1935,7 +1942,7 @@ if is_service_enabled mysql && is_service_enabled nova; then
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE nova CHARACTER SET latin1;'
# (re)create nova database
$NOVA_DIR/bin/nova-manage db sync
$NOVA_BIN_DIR/nova-manage db sync
fi
@ -2077,7 +2084,7 @@ fi
# Launch the nova-api and wait for it to answer before continuing
if is_service_enabled n-api; then
add_nova_opt "enabled_apis=$NOVA_ENABLED_APIS"
screen_it n-api "cd $NOVA_DIR && $NOVA_DIR/bin/nova-api"
screen_it n-api "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-api"
echo "Waiting for nova-api to start..."
if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://127.0.0.1:8774; do sleep 1; done"; then
echo "nova-api did not start"
@ -2097,13 +2104,13 @@ if is_service_enabled q-svc; then
quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE
elif is_service_enabled mysql && is_service_enabled nova; then
# Create a small network
$NOVA_DIR/bin/nova-manage network create private $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS
$NOVA_BIN_DIR/nova-manage network create private $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS
# Create some floating ips
$NOVA_DIR/bin/nova-manage floating create $FLOATING_RANGE
$NOVA_BIN_DIR/nova-manage floating create $FLOATING_RANGE
# Create a second pool
$NOVA_DIR/bin/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL
$NOVA_BIN_DIR/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL
fi
# Launching nova-compute should be as simple as running ``nova-compute`` but
@ -2112,11 +2119,11 @@ fi
# within the context of our original shell (so our groups won't be updated).
# Use 'sg' to execute nova-compute as a member of the libvirtd group.
# We don't check for is_service_enable as screen_it does it for us
screen_it n-cpu "cd $NOVA_DIR && sg libvirtd $NOVA_DIR/bin/nova-compute"
screen_it n-crt "cd $NOVA_DIR && $NOVA_DIR/bin/nova-cert"
screen_it n-vol "cd $NOVA_DIR && $NOVA_DIR/bin/nova-volume"
screen_it n-net "cd $NOVA_DIR && $NOVA_DIR/bin/nova-network"
screen_it n-sch "cd $NOVA_DIR && $NOVA_DIR/bin/nova-scheduler"
screen_it n-cpu "cd $NOVA_DIR && sg libvirtd $NOVA_BIN_DIR/nova-compute"
screen_it n-crt "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cert"
screen_it n-vol "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-volume"
screen_it n-net "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-network"
screen_it n-sch "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-scheduler"
screen_it n-novnc "cd $NOVNC_DIR && ./utils/nova-novncproxy --config-file $NOVA_CONF_DIR/$NOVA_CONF --web ."
screen_it n-xvnc "cd $NOVA_DIR && ./bin/nova-xvpvncproxy --config-file $NOVA_CONF_DIR/$NOVA_CONF"
screen_it n-cauth "cd $NOVA_DIR && ./bin/nova-consoleauth"
@ -2133,7 +2140,7 @@ screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONF
# Starting the nova-objectstore only if swift3 service is not enabled.
# Swift will act as s3 objectstore.
is_service_enabled swift3 || \
screen_it n-obj "cd $NOVA_DIR && $NOVA_DIR/bin/nova-objectstore"
screen_it n-obj "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-objectstore"
# Install Images