Have Immediate Shutdown call the chassis object
"Immediate Shutdown" on the GUI should be a hard power off
and differ from the "Orderly shutdown".
From https://github.com/openbmc/docs/blob/master/host-management.md:
To issue a hard power off (accomplished by powering off the chassis):
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \
-d '{"data": "xyz.openbmc_project.State.Chassis.Transition.Off"}' \
https://${bmc}/xyz/openbmc_project/state/chassis0/attr/RequestedPowerTransition
There was already an unused "chassisPowerOff" function, reworked it to
call the chassis object.
Resolves openbmc/openbmc#2890
Tested: Pointed the local GUI to a Witherspoon system and
verfied the correct rest call was made and the system hard
powered off.
Change-Id: Ibdb712656930a62e34603daa17df0d3116c86d92
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 63bf71d..730b2d8 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -237,19 +237,19 @@
},
chassisPowerOff: function(callback){
$http({
- method: 'POST',
- url: DataService.getHost() + "/xyz/openbmc_project/state/host0",
+ method: 'PUT',
+ url: DataService.getHost() + "/xyz/openbmc_project/state/chassis0/attr/RequestedPowerTransition",
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
withCredentials: true,
- data: JSON.stringify({"data": []})
+ data: JSON.stringify({"data": "xyz.openbmc_project.State.Chassis.Transition.Off"})
}).then(function(response){
var json = JSON.stringify(response.data);
var content = JSON.parse(json);
if(callback){
- return callback(content.data.CurrentPowerState);
+ return callback(content.status);
}
}, function(error){
if(callback){