Redfish request failed with response status code: 415

Am trying to get Redfish to work against my machine but it is failing already at PowerState check.
Redfish request failed with response status code: 415
How can I troubleshoot this?

Is the message about missing_packages a problem?

2020-11-06 09:08:23 provisioningserver.rpc.common: [debug] [RPC <- recieved] AmpBox({b'_answer': b'4dba'})
2020-11-06 09:08:38 provisioningserver.rpc.common: [debug] [RPC -> sent] AmpBox({b'uuid': b'wyserw', b'_command': b'ListNodePowerParameters'})
2020-11-06 09:08:38 provisioningserver.rpc.common: [debug] [RPC <- recieved] AmpBox({b'_answer': b'4d3b', b'nodes': b''})
2020-11-06 09:08:45 provisioningserver.rpc.common: [debug] [RPC <- received] AmpBox({b'_ask': b'15', b'_command': b'PowerDriverCheck', b'power_type': b'redfish'})
2020-11-06 09:08:45 provisioningserver.rpc.common: [debug] [RPC -> responding] AmpBox({b'missing_packages': b'', b'_answer': b'15'})
2020-11-06 09:08:45 provisioningserver.rpc.common: [debug] [RPC <- received] AmpBox({b'_ask': b'16', b'_command': b'PowerQuery', b'context': b'x\x9c]\x8e\xbb\<... hidden output...>VX', b'hostname': b'compute1', b'power_type': b'redfish', b'system_id': b'mbbtpg'})
2020-11-06 09:09:23 provisioningserver.rpc.common: [debug] [RPC -> responding] AmpBox({b'state': b'error', b'error_msg': b'Redfish request failed with response status code: 415.', b'_answer': b'16'})

Curl works

root@maas: snap info maas | grep installed
installed:          2.9.0~rc1-9117-g.ae6569d91            (10507) 149MB -

root@maas:~ lsb_release --codename --release --id
Distributor ID:	Ubuntu
Release:	20.04
Codename:	focal

root@maas: curl --insecure --user "${redfish_username}":"${redfish_password}" --silent --show-error "${redfish_fqdn}"/redfish/v1/Systems/"${redfish_node_id}" | jq .PowerState

root@maas: curl --insecure --user "${redfish_username}":"${redfish_password}" --silent --show-error "${redfish_fqdn}"/redfish/v1/Systems/"${redfish_node_id}" | jq .Boot
  "BootSourceOverrideTarget": "Pxe",
  "BootSourceOverrideEnabled": "Once",
  "BootSourceOverrideMode": "UEFI",
  "BootSourceOverrideTarget@Redfish.AllowableValues": [

Did you ever figure out what was going wrong? I’m having the same issue where I can power on and off with redfish commands from the maas host, but power management from the maas application fails with a 415 response status code.

To simulate what MAAS does, can you run the following?

curl -H "Content-Type: application/json; charset=utf-8" -H "Accept: application/json"--insecure --user "${redfish_username}":"${redfish_password}" --silent --show-error "${redfish_fqdn}"/redfish/v1/Systems/"${redfish_node_id}" | jq .PowerState

And assuming that fails with 415, can you try this instead?

curl -H "Content-Type: application/json" -H "Accept: application/json"--insecure --user "${redfish_username}":"${redfish_password}" --silent --show-error "${redfish_fqdn}"/redfish/v1/Systems/"${redfish_node_id}" | jq .PowerState

I’m not really sure why we include charset=utf-8, but I suspect that’s what’s causing the problem.