summaryrefslogtreecommitdiffstats
path: root/openlmi-mof-register
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2013-05-22 15:31:06 +0200
committerJan Safranek <jsafrane@redhat.com>2013-05-22 15:31:06 +0200
commit202ca77c8e5efed266ad07ddbd4c5964bc84400e (patch)
treef13ea9ae30e1ce0aaee614640a8c3f3de31eef10 /openlmi-mof-register
parentde411a7b84855bb420e39951fb4976edaa3d4e2b (diff)
downloadopenlmi-providers-202ca77c8e5efed266ad07ddbd4c5964bc84400e.tar.gz
openlmi-providers-202ca77c8e5efed266ad07ddbd4c5964bc84400e.tar.xz
openlmi-providers-202ca77c8e5efed266ad07ddbd4c5964bc84400e.zip
Start Pegasus when deregistering providers.
openlmi-mof-register should be able to deregister mof files and providers also when Pegasus is not running. This patch starts Pegasus without any listening to network, so little harm can be done. Still, if there are indications subscribed, some indications may be sent!
Diffstat (limited to 'openlmi-mof-register')
-rwxr-xr-xopenlmi-mof-register28
1 files changed, 28 insertions, 0 deletions
diff --git a/openlmi-mof-register b/openlmi-mof-register
index 50e4bc5..67f1d61 100755
--- a/openlmi-mof-register
+++ b/openlmi-mof-register
@@ -22,6 +22,26 @@
pegasus_repository="/var/lib/Pegasus/"
default_namespace="root/cimv2"
+function start_pegasus()
+{
+ # Start Pegasus CIMOM in restricted mode, listening only on its unix socket
+ /usr/sbin/cimserver daemon=true \
+ enableHttpConnection=false \
+ enableHttpsConnection=false \
+ enableRemotePrivilegedUserAccess=false \
+ slp=false
+
+ if [ "$?" != "0" ]; then
+ echo "Cannot start Pegasus" >&2
+ exit 1
+ fi
+}
+
+function stop_pegasus()
+{
+ /usr/sbin/cimserver -s
+}
+
function usage()
{
printf "Usage: $0 [ --just-mofs ] [ -n namespace ] [ -c cimom ]
@@ -101,6 +121,11 @@ function unregister()
if [ $HAS_PEGASUS -eq 1 ] && echo $cimom | grep -q 'all\|tog-pegasus';
then
+ # Pegasus must be running when removing MOF files and providers
+ if ! /usr/sbin/cimserver --status &>/dev/null; then
+ CUSTOM_PEGASUS=1
+ start_pegasus
+ fi
if [ -n "$reg" ];
then
for provider in $(sed -n 's/ *group: *//p' "$reg" | sort | uniq);
@@ -109,6 +134,9 @@ function unregister()
done
fi
mofcomp -n $namespace -r ${mofs[@]}
+ if [ -n "$CUSTOM_PEGASUS" ]; then
+ stop_pegasus
+ fi
fi
}