Merge "Decouple Fault Management from stx-config"

This commit is contained in:
Zuul 2018-08-20 21:11:21 +00:00 committed by Gerrit Code Review
commit e1e60fd5d1
2 changed files with 39 additions and 0 deletions

View File

@ -20,11 +20,13 @@ Requires: python-six >= 1.9.0
Requires: python-oslo-i18n >= 2.1.0
Requires: python-oslo-utils >= 3.20.0
Requires: python-requests
Requires: bash-completion
%description
A python client library for Fault Management
%define local_bindir /usr/bin/
%define local_etc_bash_completiond /etc/bash_completion.d/
%define pythonroot /usr/lib64/python2.7/site-packages
%define debug_package %{nil}
@ -56,6 +58,9 @@ export PBR_VERSION=%{version}
--install-data=/usr/share \
--single-version-externally-managed
install -d -m 755 %{buildroot}%{local_etc_bash_completiond}
install -p -D -m 664 tools/fm.bash_completion %{buildroot}%{local_etc_bash_completiond}/fm.bash_completion
# prep SDK package
mkdir -p %{buildroot}/usr/share/remote-clients
tar zcf %{buildroot}/usr/share/remote-clients/%{name}-%{version}.tgz --exclude='.gitignore' --exclude='.gitreview' -C .. %{name}-%{version}
@ -68,6 +73,7 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root,-)
%doc LICENSE
%{local_bindir}/*
%{local_etc_bash_completiond}/*
%{pythonroot}/%{pypi_name}/*
%{pythonroot}/%{pypi_name}-%{version}*.egg-info

View File

@ -0,0 +1,33 @@
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# bash completion for Titanium Cloud fm commands
_fm_opts="" # lazy init
_fm_flags="" # lazy init
_fm_opts_exp="" # lazy init
_fm()
{
local cur prev kbc
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [ "x$_fm_opts" == "x" ] ; then
kbc="`fm bash-completion | sed -e "s/ -h / /"`"
_fm_opts="`echo "$kbc" | sed -e "s/--[a-z0-9_-]*//g" -e "s/[ ][ ]*/ /g"`"
_fm_flags="`echo " $kbc" | sed -e "s/ [^-][^-][a-z0-9_-]*//g" -e "s/[ ][ ]*/ /g"`"
_fm_opts_exp="`echo $_fm_opts | sed -e "s/[ ]/|/g"`"
fi
if [[ " ${COMP_WORDS[@]} " =~ " "($_fm_opts_exp)" " && "$prev" != "help" ]] ; then
COMPREPLY=($(compgen -W "${_fm_flags}" -- ${cur}))
else
COMPREPLY=($(compgen -W "${_fm_opts}" -- ${cur}))
fi
return 0
}
complete -F _fm fm