action #136226
openos-autoinst IPMI backend incorrectly handle empty return value
0%
Description
Refer to the link: https://github.com/os-autoinst/os-autoinst/blob/a91a4f773eeb9a14902dadec4f5c5eca85644710/backend/ipmi.pm#L35
if $ret is empty or undefined, $ret == 0
is true, the code in line 36 and 37 will run incorrectly.
35 if ($ret == 0) {
36 $self->dell_sleep;
37 last;
38 } else {
39 sleep 4;
40 }
Example code:
# The code can print hello
if ($ret == 0) {
print "hello\n";
}
Updated by dawei_pang about 1 year ago
I encounter the issue when debugging IPMI issue: http://10.67.129.4/tests/62560
[2023-09-21T15:48:35.359401+08:00] [debug] [pid:959] IPMI ret: 1
[2023-09-21T15:48:39.359812+08:00] [debug] [pid:959] IPMI: Chassis Power Control: Up/On
[2023-09-21T15:48:43.581518+08:00] [debug] [pid:959] IPMI ret: 1
[2023-09-21T15:48:50.141416+08:00] [debug] [pid:959] IPMI ret: 1
[2023-09-21T15:48:54.210818+08:00] [debug] [pid:959] IPMI ret: 1
[2023-09-21T15:48:58.211160+08:00] [debug] [pid:959] IPMI: Chassis Power is off
[2023-09-21T15:48:58.280219+08:00] [debug] [pid:959] ** IPMI ret: **
[2023-09-21T15:49:02.281003+08:00] [info] [pid:959] ::: backend::baseclass::die_handler: Backend process died, backend errors are reported below in the following lines:
ipmitool -I lanplus -H 10.67.135.18 -U root -P [masked] chassis power on: Set Chassis Power Control to Up/On failed: Command not supported in present state at /usr/lib/os-autoinst/backend/ipmi.pm line 49.
[2023-09-21T15:49:02.345736+08:00] [debug] [pid:959] IPMI ret: 1
[2023-09-21T15:49:06.346165+08:00] [debug] [pid:959] IPMI: Chassis Power Control: Down/Off