DMTF/python-redfish-library

Patch Problem

Closed this issue · 3 comments

url = "http://IP/redfish/v1/TaskService"
arg = {"ServiceEnabled":"false"}

session = redfish.redfish_client("http://IP", "username", "password", "/redfish/v1")
session.login(auth=redfish.AuthMethod.SESSION)
respose = session.patch("redfish/v1/TaskService", args=arg)
print session.get("/redfish/v1/TaskService")

This is my code. I try to update something in server. However, the data was not changed. Did I do something wrong. Plz help me.
default
the output is above

I didn't try out your code snippet, but just from taking a quick look, one problem is that the ServiceEnabled property is a boolean, but you are supplying a string. Try it like this and see if that helps:

arg = {"ServiceEnabled": False}

You should also be able to get some more diagnostic info by looking at the response returned from the session.patch().

But whatever type, boolean or string, I use in Postman, it still can work. Will Postman convert it automatically to correct type?

Thank your help!
Finally, the problem is that Internal Server Error. So when I reboot the server whatever type of data, String or Boolean, it can work.