obmcutil: add more info to state subcommand
Adds new subcommand to request the OS state.
Adds bootprogress and osstate to the output of state/status subcommands.
Tested: The output of `obmcutil state` must look like:
```
CurrentBMCState : xyz.openbmc_project.State.BMC.BMCState.Ready
CurrentPowerState : xyz.openbmc_project.State.Chassis.PowerState.Off
CurrentHostState : xyz.openbmc_project.State.Host.HostState.Off
BootProgress : xyz.openbmc_project.State.Boot.Progress.ProgressStages.Unspecified
OperatingSystemState: xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive
```
Change-Id: I59937986317fe2ac487d355a627de1070ba813f8
Signed-off-by: Alexander Filippov <a.filippov@yadro.com>
diff --git a/obmcutil b/obmcutil
index b70babe..6f1fbd7 100644
--- a/obmcutil
+++ b/obmcutil
@@ -3,7 +3,7 @@
set -euo pipefail
OPTS="bmcstate,bootprogress,chassiskill,chassisoff,chassison,chassisstate,hoststate,\
-power,poweroff,poweron,state,status"
+osstate,power,poweroff,poweron,state,status"
USAGE="Usage: obmcutil [-h] [--wait]
{$OPTS}"
@@ -176,8 +176,15 @@
PROPERTY=CurrentHostState
state_query $SERVICE $OBJECT $INTERFACE $PROPERTY
;;
+ osstate)
+ OBJECT=$STATE_OBJECT/host0
+ SERVICE=$(mapper get-service $OBJECT)
+ INTERFACE=$STATE_INTERFACE.OperatingSystem.Status
+ PROPERTY=OperatingSystemState
+ state_query $SERVICE $OBJECT $INTERFACE $PROPERTY
+ ;;
state|status)
- for query in bmcstate chassisstate hoststate
+ for query in bmcstate chassisstate hoststate bootprogress osstate
do
handle_cmd $query
done