From 5818ed521688c72af83636b10c601268f989ee3a Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 15 Oct 2018 17:17:35 -0500 Subject: [PATCH] Add DevStack module to install tsconfig The first of a number of anticipated bits... Change-Id: I829ca465ce3001542bba240955af7ffb0c824a8b Signed-off-by: Dean Troyer --- devstack/lib/stx-update | 66 ++++++++++++++++++++++++++++++++++++++ devstack/override-defaults | 2 ++ devstack/plugin.sh | 48 +++++++++++++++++++++++++++ devstack/settings | 12 +++++++ 4 files changed, 128 insertions(+) create mode 100644 devstack/lib/stx-update create mode 100644 devstack/override-defaults create mode 100755 devstack/plugin.sh create mode 100644 devstack/settings diff --git a/devstack/lib/stx-update b/devstack/lib/stx-update new file mode 100644 index 00000000..43ff490d --- /dev/null +++ b/devstack/lib/stx-update @@ -0,0 +1,66 @@ +#!/bin/bash +# +# lib/stx-update +# Functions to control the configuration and operation of stx-update + +# Dependencies: +# +# - ``functions`` file +# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined +# - ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined +# - ``SERVICE_HOST`` +# - ``KEYSTONE_TOKEN_FORMAT`` must be defined + +# ``stack.sh`` calls the entry points in this order: +# +# - install_tsconfig +# - install_XX +# - configure_XX +# - init_XX +# - start_XX +# - stop_XX +# - cleanup_XX + +_XTRACE_STX_UPDATE=$(set +o | grep xtrace) +set -o xtrace + + +# Defaults +# -------- + +STXUPDATE_REPO=${STXUPDATE_REPO:-${GIT_BASE}/openstack/stx-update.git} +STXUPDATE_DIR=$DEST/stx-update +STXUPDATE_BRANCH=${STXUPDATE_BRANCH:-master} +TSCONFIG_DIR=$STXUPDATE_DIR/tsconfig/ +STX_PATCH_DIR=$STXUPDATE_DIR/cgcs-patch/ +STX_BIN_DIR=$(get_python_exec_prefix) +PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") + +function install_tsconfig { + # no setup.cfg in tsconfig, so we can not use pip install -e + # setup_dev_lib "tsconfig" + pushd $TSCONFIG_DIR/tsconfig + sudo python setup.py install --root=/ --install-lib=$PYTHON_SITE_DIR --prefix=/usr --install-data=/usr/share --single-version-externally-managed + popd + sudo install -d -m 755 $STX_BIN_DIR + sudo install -p -D -m 700 $TSCONFIG_DIR/scripts/tsconfig $STX_BIN_DIR/tsconfig +} + +function install_patch { + pushd $STX_PATCH_DIR/cgcs-patch + sudo python setup.py install --root=/ --install-lib=$PYTHON_SITE_DIR --prefix=/usr --install-data=/usr/share --single-version-externally-managed + popd + local stx_patch_sbindir=/etc/sbin/ + local stx_patch_sysconfdir=/etc/ + sudo install -m 755 -d ${stx_patch_sbindir} + sudo install -m 755 -d ${stx_patch_sysconfdir}/bash_completion.d + sudo install -m 755 -d ${stx_patch_sysconfdir}/goenabled.d + sudo install -m 755 -d ${stx_patch_sysconfdir}/init.d + sudo install -m 755 -d ${stx_patch_sysconfdir}/logrotate.d + sudo install -m 755 -d ${stx_patch_sysconfdir}/patching + sudo install -m 755 -d ${stx_patch_sysconfdir}/patching/patch-scripts + sudo install -m 755 -d ${stx_patch_sysconfdir}/pmon.d + sudo install -m 500 $STX_PATCH_DIR/bin/sw-patch-agent ${stx_patch_sbindir}/sw-patch-agent +} + +$_XTRACE_STX_UPDATE diff --git a/devstack/override-defaults b/devstack/override-defaults new file mode 100644 index 00000000..999da163 --- /dev/null +++ b/devstack/override-defaults @@ -0,0 +1,2 @@ +#!/bin/bash +# Plug-in overrides diff --git a/devstack/plugin.sh b/devstack/plugin.sh new file mode 100755 index 00000000..038c1d4d --- /dev/null +++ b/devstack/plugin.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# devstack/plugin.sh +# Triggers stx_update specific functions to install and configure stx_update + +# Dependencies: +# +# - ``functions`` file +# - ``DATA_DIR`` must be defined + +# ``stack.sh`` calls the entry points in this order: +# +echo_summary "stx-update devstack plugin.sh called: $1/$2" +source $DEST/stx-update/devstack/lib/stx-update + +# check for service enabled +if is_service_enabled stx-update; then + if [[ "$1" == "stack" && "$2" == "install" ]]; then + # Perform installation of source + echo_summary "Installing stx-update" + # install_update + + elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + # Configure after the other layer 1 and 2 services have been configured + echo_summary "Configuring update" + elif [[ "$1" == "stack" && "$2" == "extra" ]]; then + # Initialize and start the service + echo_summary "Initializing and start stx-update" + # init_update + # start_update + elif [[ "$1" == "stack" && "$2" == "test-config" ]]; then + # do sanity test + echo_summary "do test-config" + fi + + if [[ "$1" == "unstack" ]]; then + # Shut down services + echo_summary "Stop service" + # stop_update + : + fi + + if [[ "$1" == "clean" ]]; then + echo_summary "Clean stx-update" + # cleanup_update + : + fi +fi diff --git a/devstack/settings b/devstack/settings new file mode 100644 index 00000000..049052b8 --- /dev/null +++ b/devstack/settings @@ -0,0 +1,12 @@ +#!/bin/bash +# Devstack settings + +# Defaults +# -------- + +STX_UPDATE_NAME=stx-update + +######### Plugin Specific ########## +enable_service $STX_UPDATE_NAME tsconfig +#define_plugin $STX_UPDATE_NAME +#plugin_requires ???