DevStack plugin updates for bionic job

This makes some cleanup changes to the DevStack plugin for the
change to master and bionic.
* Define values for precedence handling by the upstream devstack playbook
* Add STX_INST_DIR for a deterministic install location
* Update the linters job in tox.ini to correctly include the devstack plugin

Change-Id: Ida3a6c07d49510a6ec0276e83a3f966b826de26e
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
This commit is contained in:
Dean Troyer 2019-02-20 14:08:07 -06:00
parent c763e0de07
commit 6be5a751c9
4 changed files with 43 additions and 19 deletions

View File

@ -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

View File

@ -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"

View File

@ -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

14
tox.ini
View File

@ -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"
-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