From 9af70ae48e0ee51b19fb06b7ab74d47d35b5621e Mon Sep 17 00:00:00 2001 From: "Martin, Chen" Date: Wed, 13 Mar 2019 02:20:17 +0800 Subject: [PATCH] [devstack] python-inventoryclient utility in stx-metal Install and cleanup python-inventoryclient Task: 29246 Story: 2003161 Depends-on: https://review.openstack.org/#/c/641894/ Change-Id: I9ad9cbba78647044d42859e94b82ce71c23da5e2 Signed-off-by: Martin, Chen --- .zuul.yaml | 1 + devstack/lib/stx-metal | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/.zuul.yaml b/.zuul.yaml index c809b6ed..8e5f49f7 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -45,6 +45,7 @@ inventory-api: true inventory-conductor: true inventory-agent: true + inventory-client: true fsmon: true hbs: true hwmon: true diff --git a/devstack/lib/stx-metal b/devstack/lib/stx-metal index 8b254703..ab7438ca 100644 --- a/devstack/lib/stx-metal +++ b/devstack/lib/stx-metal @@ -107,6 +107,14 @@ function build_inventory { popd } +function build_inventory_client { + pushd ${STX_METAL_DIR}/python-inventoryclient/inventoryclient + + python setup.py build + + popd +} + function install_metal { install_mtce_common # components could be seperately installed if @@ -126,6 +134,9 @@ function install_metal { if is_service_enabled inventory-api || is_service_enabled inventory-conductor || is_service_enabled inventory-agent; then install_inventory fi + if is_service_enabled inventory-client; then + install_inventory_client + fi } function install_mtce_common { @@ -278,6 +289,24 @@ function install_inventory { popd } +function install_inventory_client { + pushd ${STX_METAL_DIR}/python-inventoryclient/inventoryclient + + build_inventory_client + + sudo python setup.py install \ + --root=/ \ + --install-lib=$PYTHON_SITE_DIR \ + --prefix=/usr \ + --install-data=/usr/share \ + --single-version-externally-managed + + sudo install -d -m 755 /etc/bash_completion.d/ + sudo install -p -D -m 664 tools/inventory.bash_completion /etc/bash_completion.d/inventory.bash_completion + + popd +} + function install_mtce_storage { local sysconf_dir=${SYSCONFDIR} local unit_dir=${SYSCONFDIR}/systemd/system @@ -940,6 +969,9 @@ function cleanup_metal { if is_service_enabled inventory-api || is_service_enabled inventory-conductor || is_service_enabled inventory-agent; then cleanup_inventory fi + if is_service_enabled inventory-client; then + cleanup_inventory_client + fi } function cleanup_inventory { @@ -964,6 +996,12 @@ function cleanup_inventory { sudo rm -rf ${unit_dir}/inventory-conductor.service } +function cleanup_inventory_client { + sudo pip uninstall -y inventoryclient + + sudo rm -rf /etc/bash_completion.d/inventory.bash_completion +} + function uninstall_files { local dest_dir=$1 local dest_file_array=($2)