occ-active:Exit gracefully if occ status object not available
Resolves openbmc/openbmc#2189
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
Change-Id: I57244e14029c4cfed716208a624b79a83e9e2c83
diff --git a/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh b/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
index 0d4857c..a6097e5 100755
--- a/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
+++ b/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
@@ -11,7 +11,10 @@
echo " disable - set occ's to inactive state"
exit -1
fi
-busctl tree org.open_power.OCC.Control --list | grep occ | xargs -n1 -I{} \
- busctl set-property org.open_power.OCC.Control {} \
- org.open_power.OCC.Status OccActive b $value
+
+OCC_CONTROL_SERVICE="org.open_power.OCC.Control"
+
+busctl tree $OCC_CONTROL_SERVICE --list | grep occ | xargs -r -n1 -I{} \
+ busctl set-property $OCC_CONTROL_SERVICE {} org.open_power.OCC.Status \
+ OccActive b $value
exit 0