From 9fbeeddc3b6ea28c06d5468b0bc28966d4fbc6ce Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 17 Aug 2012 12:52:27 -0400 Subject: [PATCH] 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 --- exercises/quantum.sh | 5 ++++- lib/ceilometer | 12 +++++++++--- lib/cinder | 13 +++++++++---- stack.sh | 29 ++++++++++++++++++----------- 4 files changed, 40 insertions(+), 19 deletions(-) diff --git a/exercises/quantum.sh b/exercises/quantum.sh index e19a78e8fa..33ae14ea92 100755 --- a/exercises/quantum.sh +++ b/exercises/quantum.sh @@ -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 diff --git a/lib/ceilometer b/lib/ceilometer index 069e5395bf..4c3bb52a90 100644 --- a/lib/ceilometer +++ b/lib/ceilometer @@ -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" } diff --git a/lib/cinder b/lib/cinder index 796c107160..525b6c6e10 100644 --- a/lib/cinder +++ b/lib/cinder @@ -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) diff --git a/stack.sh b/stack.sh index 2eef0c6689..50cefe8d73 100755 --- a/stack.sh +++ b/stack.sh @@ -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