DMTF / Redfishtool

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

The CLI option "match" (-M/--Match) is not operating correctly. #108

Closed maugustosilva closed 1 year ago

maugustosilva commented 1 year ago

This was tested with a bunch of VMs with latest sushy-emulator. Apologies in advance for the verbose output, but it is relevant on debugging.

Here is the "target" VM.

root@epoctravisbmc:~# redfishtool -r 100.127.0.151:12000 -S IfSendingCredentials -A None Systems -I 7826cef7-485a-4b90-871b-174db323eb45
{
    "@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
    "Id": "7826cef7-485a-4b90-871b-174db323eb45",
    "Name": "epoctravisbootstrap",
    "UUID": "7826cef7-485a-4b90-871b-174db323eb45",
    "Manufacturer": "Sushy Emulator",
    "Status": {
        "State": "Enabled",
        "Health": "OK",
        "HealthRollUp": "OK"
    },
    "PowerState": "On",
    "Boot": {
        "BootSourceOverrideEnabled": "Continuous",
        "BootSourceOverrideTarget": "Hdd",
        "BootSourceOverrideTarget@Redfish.AllowableValues": [
            "Pxe",
            "Cd",
            "Hdd"
        ]
    },
    "ProcessorSummary": {
        "Count": 4,
        "Status": {
            "State": "Enabled",
            "Health": "OK",
            "HealthRollUp": "OK"
        }
    },
    "MemorySummary": {
        "TotalSystemMemoryGiB": 4,
        "Status": {
            "State": "Enabled",
            "Health": "OK",
            "HealthRollUp": "OK"
        }
    },
    "Bios": {
        "@odata.id": "/redfish/v1/Systems/7826cef7-485a-4b90-871b-174db323eb45/BIOS"
    },
    "Processors": {
        "@odata.id": "/redfish/v1/Systems/7826cef7-485a-4b90-871b-174db323eb45/Processors"
    },
    "Memory": {
        "@odata.id": "/redfish/v1/Systems/7826cef7-485a-4b90-871b-174db323eb45/Memory"
    },
    "EthernetInterfaces": {
        "@odata.id": "/redfish/v1/Systems/7826cef7-485a-4b90-871b-174db323eb45/EthernetInterfaces"
    },
    "SimpleStorage": {
        "@odata.id": "/redfish/v1/Systems/7826cef7-485a-4b90-871b-174db323eb45/SimpleStorage"
    },
    "Storage": {
        "@odata.id": "/redfish/v1/Systems/7826cef7-485a-4b90-871b-174db323eb45/Storage"
    },
    "IndicatorLED": "Lit",
    "Links": {
        "Chassis": [
            {
                "@odata.id": "/redfish/v1/Chassis/15693887-7984-9484-3272-842188918912"
            }
        ],
        "ManagedBy": [
            {
                "@odata.id": "/redfish/v1/Managers/7826cef7-485a-4b90-871b-174db323eb45"
            }
        ]
    },
    "Actions": {
        "#ComputerSystem.Reset": {
            "target": "/redfish/v1/Systems/7826cef7-485a-4b90-871b-174db323eb45/Actions/ComputerSystem.Reset",
            "ResetType@Redfish.AllowableValues": [
                "On",
                "ForceOff",
                "GracefulShutdown",
                "GracefulRestart",
                "ForceRestart",
                "Nmi",
                "ForceOn"
            ]
        }
    },
    "@odata.context": "/redfish/v1/$metadata#ComputerSystem.ComputerSystem",
    "@odata.id": "/redfish/v1/Systems/7826cef7-485a-4b90-871b-174db323eb45",
    "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
}

The idea is to get this VM via either Name or UUID.

root@epoctravisbmc:~# redfishtool -vvvvvv -r 100.127.0.151:12000 -S IfSendingCredentials -A None Systems -M Name:epoctravisbootstrap
#DB5: Main: subcmd: Systems, subCmdArgs:['Systems']
#DB5: Main: verbose=5, status=0, user=, password=, rhost=100.127.0.151:12000
#DB5: Main: token=None, RedfishVersion=v1, Auth=None, Timeout=10, NonBlocking=False
#DB5: Main: prop=None, Id=None, Match=Name:epoctravisbootstrap, First=False, -1=False, Link=None
#DB5: Main: gotIdOptn=False, IdOptnCount=1, gotPropOptn=False, gotMatchOptn=True, gotEntriesOptn=False
#DB5: Main: 2nd-Level Collection Member reference options: -i<id>=None, -m<match>=None:None, -l<link>=None -all=False
#DB5: Main: 2nd-level Collection Member parsing: gotIdLevel2Optn=False, gotMatchLevel2Optn=False, IdLevel2OptnCount=0
#DB5: Main: configFile=, Secure=IfSendingCredentials, waitNum:waitTime=1:3, Degug=00000000
#DB5: Main: Headers=None
#DB5: Main: options parsed.  Now lookup subcommand and execute it
#DB5: runSubCmd: subcmd: Systems
#DB5: runSubCmd: argvs:  ['Systems']
#DB5: runSubCmd: found SubCmd: Systems in table. executing
#DB4: SystemsMain:  subcommand: Systems
#DB5: Systems: operation=get, args=None
#DB5: Systems:runOperation: operation: get
#DB5: Systems:runOperation: args:  None
#DB5: Systems:runOperation: found Oper: Systems in table. executing
#DB4: Systems:get: in operation
#DB4: Systems:get: in getCollection
#DB4: ServiceRoot: in getServiceRoot
#DB5: getVersionsAndRootPath: read versions from rhost
#DB5: Transport.getRootPath: protocolVer to use=v1,  rootPath=/redfish/v1/
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/, rpath=/redfish/v1/
#DB5: Transport.rftProcessRequest: apiType=1
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/
#DB4: Systems:getCollection: link is: /redfish/v1/Systems
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/, rpath=/redfish/v1/Systems
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems
#
#  Systems Collection:
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/6db11a10-b7e5-4593-8e94-1b51e4a4c4fa
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/6db11a10-b7e5-4593-8e94-1b51e4a4c4fa
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/6db11a10-b7e5-4593-8e94-1b51e4a4c4fa
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=epoctraviswork2
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/1f652d55-0c36-485f-84a1-b43b98ee33e4
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/1f652d55-0c36-485f-84a1-b43b98ee33e4
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/1f652d55-0c36-485f-84a1-b43b98ee33e4
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=epoctravisloadbalancer
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/eee6285a-6598-42aa-a0bc-5e5eb8c9cd66
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/eee6285a-6598-42aa-a0bc-5e5eb8c9cd66
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/eee6285a-6598-42aa-a0bc-5e5eb8c9cd66
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=bmklqavm2
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/11ea95de-990d-4d1a-8be6-821d4019da16
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/11ea95de-990d-4d1a-8be6-821d4019da16
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/11ea95de-990d-4d1a-8be6-821d4019da16
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=bmklqavm7
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/785ff52c-3dc5-4531-8aa1-421acddbf716
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/785ff52c-3dc5-4531-8aa1-421acddbf716
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/785ff52c-3dc5-4531-8aa1-421acddbf716
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=bmklqavm1
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/4792ba7d-2c69-4695-825b-d4b7a73fbdd3
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/4792ba7d-2c69-4695-825b-d4b7a73fbdd3
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/4792ba7d-2c69-4695-825b-d4b7a73fbdd3
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=epoctravisctrl2
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/ae52ea5c-a532-4a26-b71c-815b7d3f08a0
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/ae52ea5c-a532-4a26-b71c-815b7d3f08a0
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/ae52ea5c-a532-4a26-b71c-815b7d3f08a0
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=epoctravisctrl1
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/9eb379d9-0bd8-4ba2-9cc3-70b1c1685a07
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/9eb379d9-0bd8-4ba2-9cc3-70b1c1685a07
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/9eb379d9-0bd8-4ba2-9cc3-70b1c1685a07
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=epoctravisctrl0
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/05b5c99a-f60e-4687-a1a6-88c6ebc2eef0
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/05b5c99a-f60e-4687-a1a6-88c6ebc2eef0
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/05b5c99a-f60e-4687-a1a6-88c6ebc2eef0
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=bmklqavm6
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/7d3d15e3-1a66-400b-ab2a-20d6624ca39e
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/7d3d15e3-1a66-400b-ab2a-20d6624ca39e
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/7d3d15e3-1a66-400b-ab2a-20d6624ca39e
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=epoctraviswork1
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/d1e48ff5-4c04-4559-a58a-055b8535fe31
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/d1e48ff5-4c04-4559-a58a-055b8535fe31
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/d1e48ff5-4c04-4559-a58a-055b8535fe31
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=traviskubeu3
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/7a8ed50f-530c-44f6-8c14-fbfaab9b684f
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/7a8ed50f-530c-44f6-8c14-fbfaab9b684f
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/7a8ed50f-530c-44f6-8c14-fbfaab9b684f
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=traviskubeu1
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/df4b9ff7-e8f5-46b2-b0aa-66de1906178c
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/df4b9ff7-e8f5-46b2-b0aa-66de1906178c
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/df4b9ff7-e8f5-46b2-b0aa-66de1906178c
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=bmklqavm0
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/ca645445-0850-44a0-9cf0-c979c90d88ce
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/ca645445-0850-44a0-9cf0-c979c90d88ce
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/ca645445-0850-44a0-9cf0-c979c90d88ce
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=traviskubeu2
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/a4bfe76d-efc6-446c-a541-f274a80bf315
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/a4bfe76d-efc6-446c-a541-f274a80bf315
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/a4bfe76d-efc6-446c-a541-f274a80bf315
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=bmklqavm5
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/a025c646-50d0-43c1-a8bb-9d68fe2a4d3f
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/a025c646-50d0-43c1-a8bb-9d68fe2a4d3f
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/a025c646-50d0-43c1-a8bb-9d68fe2a4d3f
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=bmklqavm3
-> #DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/7826cef7-485a-4b90-871b-174db323eb45
-> #DB5: Transport.rftProcessRequest: apiType=2
-> #DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/7826cef7-485a-4b90-871b-174db323eb45
-> #REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/7826cef7-485a-4b90-871b-174db323eb45
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/b16d963f-2b8d-4a29-8b90-9ef91afc27b6
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/b16d963f-2b8d-4a29-8b90-9ef91afc27b6
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/b16d963f-2b8d-4a29-8b90-9ef91afc27b6
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=epoctravisbmc
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/e4c8051a-8c59-484f-bb9c-b6a2645d5883
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/e4c8051a-8c59-484f-bb9c-b6a2645d5883
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/e4c8051a-8c59-484f-bb9c-b6a2645d5883
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=epoctraviswork3
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://100.127.0.151:12000/redfish/v1/Systems, rpath=/redfish/v1/Systems/e3114377-fac9-4668-b82a-193d549484e1
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://100.127.0.151:12000/redfish/v1/Systems/e3114377-fac9-4668-b82a-193d549484e1
#REQUEST: Transport:SendRecv:    GET http://100.127.0.151:12000/redfish/v1/Systems/e3114377-fac9-4668-b82a-193d549484e1
#DB4: Transport:getPathBy:Match: failed match: matchProp=Name, matchValue=epoctravisbootstrap, readValue=bmklqavm4
#DB4: SystemsOperations:get: got a path, now get entries
#
#  Systems Resource:
#DB5: Systems: operation exited OK
#DB5: Main: subcommand exited OK.
#DB5:     Status code:200
{
    "@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
    "Id": "e3114377-fac9-4668-b82a-193d549484e1",
    "Name": "bmklqavm4",
    "UUID": "e3114377-fac9-4668-b82a-193d549484e1",
    "Manufacturer": "Sushy Emulator",
    "Status": {
        "State": "Enabled",
        "Health": "OK",
        "HealthRollUp": "OK"
    },
    "PowerState": "On",
    "Boot": {
        "BootSourceOverrideEnabled": "Continuous",
        "BootSourceOverrideTarget": "Hdd",
        "BootSourceOverrideTarget@Redfish.AllowableValues": [
            "Pxe",
            "Cd",
            "Hdd"
        ]
    },
    "ProcessorSummary": {
        "Count": 2,
        "Status": {
            "State": "Enabled",
            "Health": "OK",
            "HealthRollUp": "OK"
        }
    },
    "MemorySummary": {
        "TotalSystemMemoryGiB": 8,
        "Status": {
            "State": "Enabled",
            "Health": "OK",
            "HealthRollUp": "OK"
        }
    },
    "Bios": {
        "@odata.id": "/redfish/v1/Systems/e3114377-fac9-4668-b82a-193d549484e1/BIOS"
    },
    "Processors": {
        "@odata.id": "/redfish/v1/Systems/e3114377-fac9-4668-b82a-193d549484e1/Processors"
    },
    "Memory": {
        "@odata.id": "/redfish/v1/Systems/e3114377-fac9-4668-b82a-193d549484e1/Memory"
    },
    "EthernetInterfaces": {
        "@odata.id": "/redfish/v1/Systems/e3114377-fac9-4668-b82a-193d549484e1/EthernetInterfaces"
    },
    "SimpleStorage": {
        "@odata.id": "/redfish/v1/Systems/e3114377-fac9-4668-b82a-193d549484e1/SimpleStorage"
    },
    "Storage": {
        "@odata.id": "/redfish/v1/Systems/e3114377-fac9-4668-b82a-193d549484e1/Storage"
    },
    "IndicatorLED": "Lit",
    "Links": {
        "Chassis": [
            {
                "@odata.id": "/redfish/v1/Chassis/15693887-7984-9484-3272-842188918912"
            }
        ],
        "ManagedBy": [
            {
                "@odata.id": "/redfish/v1/Managers/e3114377-fac9-4668-b82a-193d549484e1"
            }
        ]
    },
    "Actions": {
        "#ComputerSystem.Reset": {
            "target": "/redfish/v1/Systems/e3114377-fac9-4668-b82a-193d549484e1/Actions/ComputerSystem.Reset",
            "ResetType@Redfish.AllowableValues": [
                "On",
                "ForceOff",
                "GracefulShutdown",
                "GracefulRestart",
                "ForceRestart",
                "Nmi",
                "ForceOn"
            ]
        }
    },
    "@odata.context": "/redfish/v1/$metadata#ComputerSystem.ComputerSystem",
    "@odata.id": "/redfish/v1/Systems/e3114377-fac9-4668-b82a-193d549484e1",
    "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
}
#DB5: rfCleanup:Cleaningup session: None
#DB5: Main: Done

So, from what I can see, in the lines I have marked with ->, the Transport:getPathBy:Match: actually successfully matches the correct (Name) parameter, but then the loop is not interrupted and the last system on the list is returned instead (which is a dangerous error, IMO, as one could end up powering off the wrong system).

mraineri commented 1 year ago

It looks like right here we need to return the resource data found when we observed the match. It returns the correct URI, but all other info returned (like you already said) is from the last loop iteration.

https://github.com/DMTF/Redfishtool/blob/faa99dccce00f319d5bb4a9f96aed6672279e06f/redfishtoollib/redfishtoolTransport.py#L1037

It is intentional we're not breaking out of the loop on the match immediately; we want to ensure there is exactly one resource that matches, and if multiple resources match, we return an error. So, we'll need to save off the response data when we hit the matching case initially.

maugustosilva commented 1 year ago

Ah, makes perfect sense not exiting immediately indeed! However, we do need the right answer at the end, and saving the response data should do it.

Thanks for the prompt answer.