DMTF / Redfishtool

A Python34 program that implements a command line tool for accessing the Redfish API.
Other
231 stars 69 forks source link

--match opt does not parse MAC address correctly #37

Closed blakehilliard closed 6 years ago

blakehilliard commented 6 years ago

When parsing "key:value" from a -m/--match opt, it should read the key as the value up to the first ":", not the last one. Otherwise, you get this behavior when trying to match a MAC address:

python3 redfishtool.py ... EthernetInterfaces -m "MACAddress:08:00:69:17:A1:1B"
Traceback (most recent call last):
  File "redfishtool.py", line 18, in <module>
    main(sys.argv)
  File "/root/Redfishtool/redfishtool/redfishtoolMain.py", line 362, in main
    rc,r,j,d=runSubCmd(rft)
  File "/root/Redfishtool/redfishtool/redfishtoolMain.py", line 439, in runSubCmd
    rc,r,j,d=subCmdTable[rft.subcommand](rft,cmdTop=True)
  File "/root/Redfishtool/redfishtool/Managers.py", line 159, in ManagersMain
    rc,r,j,d = self.runOperation(rft)
  File "/root/Redfishtool/redfishtool/Managers.py", line 116, in runOperation
    rc,r,j,d=operationTable[self.operation](self, op, rft, cmdTop=True)
  File "/root/Redfishtool/redfishtool/Managers.py", line 521, in getEnetInterfaces
    path2,rc,r,j,d=rft.getLevel2ResourceById(rft,r,d)
  File "/root/Redfishtool/redfishtool/redfishtoolTransport.py", line 964, in getLevel2ResourceById
    if( d[rft.matchLevel2Prop] == rft.matchLevel2Value ):
KeyError: 'MACAddress:08:00:69:17:A1'

From the above stack trace, it appears that from MACAddress:08:00:69:17:A1:1B it reads "1B" as the value and all before that as the key.

mraineri commented 6 years ago

1/25: Agreed this is an issue with the parameter parsing