diff --git a/devstack/lib/stx-update b/devstack/lib/stx-update index c20565f2..7a17098a 100644 --- a/devstack/lib/stx-update +++ b/devstack/lib/stx-update @@ -1,12 +1,6 @@ #!/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 # ``stack.sh`` calls the entry points in this order: # @@ -25,20 +19,27 @@ set -o xtrace # -------- STXUPDATE_REPO=${STXUPDATE_REPO:-${GIT_BASE}/openstack/stx-update.git} -STXUPDATE_DIR=$DEST/stx-update +STXUPDATE_DIR=${GITDIR[$STX_UPDATE_NAME]} STX_PATCH_DIR=$STXUPDATE_DIR/cgcs-patch/ TSCONFIG_DIR=$STXUPDATE_DIR/tsconfig/ -STX_BIN_DIR=$(get_python_exec_prefix) +# STX_INST_DIR should be a non-root-writable place to install build artifacts +STX_INST_DIR=${STX_INST_DIR:-$DEST/usr} +STX_BIN_DIR=$STX_INST_DIR/bin PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") function install_sw_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 + 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=/usr/local/sbin/ + local stx_patch_sbindir=$STX_INST_DIR/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 @@ -55,7 +56,12 @@ 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 + 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 @@ -69,4 +75,5 @@ function install_update { install_tsconfig fi } + $_XTRACE_STX_UPDATE diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 14dba444..cce913c7 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -1,7 +1,7 @@ #!/bin/bash # devstack/plugin.sh -# Triggers stx_update specific functions to install and configure stx_update +# Triggers specific functions to install and configure stx-update echo_summary "stx-update devstack plugin.sh called: $1/$2" @@ -14,6 +14,7 @@ if is_service_enabled stx-update; then elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then # Configure after the other layer 1 and 2 services have been configured echo_summary "Configure stx-update" + # configure_update elif [[ "$1" == "stack" && "$2" == "extra" ]]; then # Initialize and start the service echo_summary "Initialize and start stx-update" diff --git a/devstack/settings b/devstack/settings index 02198e36..4142b9fc 100644 --- a/devstack/settings +++ b/devstack/settings @@ -1,6 +1,14 @@ #!/bin/bash # Devstack settings +# This plugin enables StarlingX stx-update services and follows the +# DevStack plugin contract: +# https://docs.openstack.org/devstack/latest/plugins.html#plugin-sh-contract + +# Services +# sw-patch +# tsconfig + # Defaults # -------- @@ -8,7 +16,11 @@ STX_UPDATE_NAME=stx-update ######### Plugin Specific ########## enable_service $STX_UPDATE_NAME -#define_plugin $STX_UPDATE_NAME + +# This must not use any variables to work properly in OpenStack's DevStack playbook +define_plugin stx-update +# This works for Zuul jobs using OpenStack's DevStack roles +#plugin_requires stx-update stx-xxxx # Initial source of lib script source $DEST/stx-update/devstack/lib/stx-update diff --git a/tox.ini b/tox.ini index f1ad4c30..3cf5e33d 100644 --- a/tox.ini +++ b/tox.ini @@ -37,17 +37,21 @@ deps = -r{toxinidir}/requirements.txt basepython = python3 whitelist_externals = bash commands = - bash -c "find {toxinidir} \ - \( -name .tox -prune \) \ - -o -type f -name '*.yaml' \ - -print0 | xargs --no-run-if-empty -0 yamllint" bash -c "find {toxinidir} \ -not \( -type d -name .?\* -prune \) \ -type f \ -not -name \*~ \ -not -name \*.md \ - -name \*.sh \ - -print0 | xargs --no-run-if-empty -0 bashate -v -e 'E*' -iE006" + \( \ + -name \*.sh \ + -or -not -wholename \*/devstack/files/\* \ + -wholename \*/devstack/\* \ + \) \ + -print0 | xargs -0 bashate -v -e 'E*' -iE006" + bash -c "find {toxinidir} \ + \( -name .tox -prune \) \ + -o -type f -name '*.yaml' \ + -print0 | xargs -0 yamllint" [flake8] # ignore below errors , will fix flake8 errors in future