xcat2 / xcat-core

Code repo for xCAT core packages
Eclipse Public License 1.0
361 stars 171 forks source link

[openbmc] rflash with l option does not check the command line input #4522

Closed hu-weihua closed 6 years ago

hu-weihua commented 6 years ago

xcat version: Version 2.13.9 (git commit af7bfe8489888dae3ef285233d1edc468750b051, built Wed Dec 13 06:16:04 EST 2017)

rflash -l does not check the command line input. When offering a invalid input, it shill work.

Man page looks like below:

   OpenPOWER OpenBMC specific :
       rflash noderange {[-c|--check] | [-l|--list]}

       rflash noderange tar_file_path {[-c|--check] | [-a|--activate] | [-u|--upload]}

       rflash noderange image_id {[-a|--activate] | [-d|--delete]}

The output of invalid usage:

RUN:rflash f6u17 -l /tmp/abc123.tz [Thu Dec 14 01:57:58 2017]
ElapsedTime:2 sec
RETURN rc = 0
OUTPUT:
Thu Dec 14 01:57:59 2017 OpenBMC: [openbmc_debug]
Thu Dec 14 01:57:59 2017 f6u17: [openbmc_debug] curl -k -c cjar -H "Content-Type: application/json" -d '{ "data": ["root", "xxxxxx"] }' https://10.6.17.100/login
Thu Dec 14 01:57:59 2017 f6u17: [openbmc_debug] login_response 200 OK
Thu Dec 14 01:57:59 2017 f6u17: [openbmc_debug] curl -k -b cjar -X GET -H "Content-Type: application/json" https://10.6.17.100/xyz/openbmc_project/software/enumerate
Thu Dec 14 01:58:00 2017 f6u17: [openbmc_debug] rflash_list_response 200 OK
f6u17: ID       Purpose State      Version
f6u17: -------------------------------------------------------
f6u17: b3000fc6 BMC     Active(*)  ibm-v2.0-0-r13.3-0-gd624923
f6u17: 3a7f1407 BMC     Active     ibm-v2.0-0-r13-0-g3a160ac
f6u17: 78abd177 Host    Active     IBM-witherspoon-ibm-OP9_v1.19_1.88
f6u17: df4b8673 Host    Active(*)  IBM-witherspoon-ibm-OP9_v1.19_1.90
f6u17:
CHECK:output =~ Error: Invalid option   [Failed]

RUN:rflash f6u17 /tmp/abc123.tz -l [Thu Dec 14 01:58:00 2017]
ElapsedTime:1 sec
RETURN rc = 0
OUTPUT:
Thu Dec 14 01:58:00 2017 OpenBMC: [openbmc_debug]
Thu Dec 14 01:58:00 2017 f6u17: [openbmc_debug] curl -k -c cjar -H "Content-Type: application/json" -d '{ "data": ["root", "xxxxxx"] }' https://10.6.17.100/login
Thu Dec 14 01:58:01 2017 f6u17: [openbmc_debug] login_response 200 OK
Thu Dec 14 01:58:01 2017 f6u17: [openbmc_debug] curl -k -b cjar -X GET -H "Content-Type: application/json" https://10.6.17.100/xyz/openbmc_project/software/enumerate
Thu Dec 14 01:58:01 2017 f6u17: [openbmc_debug] rflash_list_response 200 OK
f6u17: ID       Purpose State      Version
f6u17: -------------------------------------------------------
f6u17: b3000fc6 BMC     Active(*)  ibm-v2.0-0-r13.3-0-gd624923
f6u17: 3a7f1407 BMC     Active     ibm-v2.0-0-r13-0-g3a160ac
f6u17: 78abd177 Host    Active     IBM-witherspoon-ibm-OP9_v1.19_1.88
f6u17: df4b8673 Host    Active(*)  IBM-witherspoon-ibm-OP9_v1.19_1.90
f6u17:
bybai commented 6 years ago

This is duplicate with #4508 and #4511, the root cause is the same that : invalid input option check should be added for non -a|-u|-c|-d. I will close this defect.