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
diff --git a/exercises/quantum.sh b/exercises/quantum.sh
index e19a78e..33ae14e 100755
--- a/exercises/quantum.sh
+++ b/exercises/quantum.sh
@@ -75,7 +75,10 @@
#------------------------------------------------------------------------------
# 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
diff --git a/lib/ceilometer b/lib/ceilometer
index 069e539..4c3bb52 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -23,6 +23,12 @@
# 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 @@
# 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"
}
diff --git a/lib/cinder b/lib/cinder
index 796c107..525b6c6 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -25,6 +25,11 @@
# 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 @@
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 @@
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)
diff --git a/stack.sh b/stack.sh
index 2eef0c6..50cefe8 100755
--- a/stack.sh
+++ b/stack.sh
@@ -1760,6 +1760,13 @@
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 @@
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 @@
# 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 @@
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 @@
# 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 @@
# 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