summaryrefslogtreecommitdiffstats
path: root/openlmi-mof-register
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2013-01-09 13:29:59 +0100
committerJan Safranek <jsafrane@redhat.com>2013-01-09 13:29:59 +0100
commit390829b50a914285fa4fd91b83b505dc1a044b14 (patch)
tree89d4245460bbb32c80866659a4670690dfc2d2d0 /openlmi-mof-register
parent3a85cda6af464c93c6c18780ffb20102f487a33a (diff)
downloadopenlmi-providers-390829b50a914285fa4fd91b83b505dc1a044b14.zip
openlmi-providers-390829b50a914285fa4fd91b83b505dc1a044b14.tar.gz
openlmi-providers-390829b50a914285fa4fd91b83b505dc1a044b14.tar.xz
Allow more mofs to be registered by openlmi-mof-register.
The script is backward compatible, i.e. some ugly bash arrays needed to be used.
Diffstat (limited to 'openlmi-mof-register')
-rwxr-xr-xopenlmi-mof-register44
1 files changed, 30 insertions, 14 deletions
diff --git a/openlmi-mof-register b/openlmi-mof-register
index cce058b..c74c0e1 100755
--- a/openlmi-mof-register
+++ b/openlmi-mof-register
@@ -23,16 +23,17 @@ pegasus_repository="/var/lib/Pegasus/repository"
function usage()
{
- printf "Usage: $0 [ register | unregister ] mof reg\n"
+ printf "Usage: $0 [ register | unregister ] <mof> [mof] [...] <reg>\n"
}
function register()
{
- mof=$1
- reg=$2
+ reg=$1
+ shift
+ mofs="$@"
if [ $HAS_SFCBD -eq 1 ];
then
- /usr/bin/sfcbstage -r $reg $mof
+ /usr/bin/sfcbstage -r "$reg" "$mofs"
/usr/bin/sfcbrepos -f
/usr/bin/systemctl reload-or-try-restart sblim-sfcb.service
fi
@@ -47,30 +48,36 @@ function register()
CIMMOF="/usr/bin/cimmofl -R $pegasus_repository"
fi
- $CIMMOF -uc $mof
+ $CIMMOF -uc $mofs
if [ -x $(dirname $0)/openlmi-register-pegasus ];
then
- cat $reg | $(dirname $0)/openlmi-register-pegasus | $CIMMOF -uc -n root/PG_Interop
+ cat "$reg" | $(dirname $0)/openlmi-register-pegasus | $CIMMOF -uc -n root/PG_Interop
else
- cat $reg | /usr/libexec/openlmi-register-pegasus | $CIMMOF -uc -n root/PG_Interop
+ cat "$reg" | /usr/libexec/openlmi-register-pegasus | $CIMMOF -uc -n root/PG_Interop
fi
fi
}
function unregister()
{
- mof=$1
- reg=$2
+ reg=$1
+ shift
+ # convert mofs to `basename mof`
+ declare -a mofs=("$@")
+ for ((i=0; i<${#mofs[@]}; i++)); do
+ mofs[$i]=$(basename "${mofs[$i]}")
+ done
+
if [ $HAS_SFCBD -eq 1 ];
then
- /usr/bin/sfcbunstage -r $(basename $reg) $(basename $mof)
+ /usr/bin/sfcbunstage -r $(basename "$reg") ${mofs[@]}
/usr/bin/sfcbrepos -f
/usr/bin/systemctl reload-or-try-restart sblim-sfcb.service
fi
if [ $HAS_PEGASUS -eq 1 ];
then
- for provider in $(sed -n 's/ *location: *//p' $reg | sort | uniq);
+ for provider in $(sed -n 's/ *location: *//p' "$reg" | sort | uniq);
do
/usr/bin/cimprovider -d -m ${provider} && /usr/bin/cimprovider -r -m ${provider}
done
@@ -99,12 +106,21 @@ fi
# TODO: check if at least one server is installed
-case $1 in
+CMD=$1
+shift
+
+# parse the reg and mofs - use $@ and remove the last item
+declare -a ARGS=("$@")
+LEN=$(( ${#ARGS[@]} -1 ))
+REG=${ARGS[$LEN]}
+MOFS=(${ARGS[@]:0:$(($LEN))})
+
+case $CMD in
register)
- register $2 $3
+ register $REG ${MOFS[@]}
break;;
unregister)
- unregister $2 $3
+ unregister $REG ${MOFS[@]}
break;;
**)
usage