I managed to capture traffic while using the webUI because it is working via WebUI. Using tcpdump I can see in the websocket traffic the POST call to API with these datas :
{"method":"machine.create_raid","type":0,"params":{"level":"raid-0","name":"md042","system_id":"nchbrq","tags":[],"block_devices":[849,850]},"request_id":16}
But when I do it through CLI, I have the same problem
maas preDEV-maas-user raids create nchbrq name=test level=raid-0 block_devices=[849,850]
{"block_devices": ["Select a valid choice. [849,850] is not one of the available choices."]}
I also captured the API call of the CLI still a POST with multi-part DATA, we can see the base64 encoded value of all the parameters
POST /MAAS/api/2.0/nodes/nchbrq/raids/ HTTP/1.1
Host: 192.168.2.2:5240
content-type: multipart/form-data; boundary="===============5263540941563289710=="
mime-version: 1.0
content-length: 642
authorization: OAuth oauth_nonce="*******************", oauth_timestamp="***********", oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="GByPaU5yHkpppvKn9J", oauth_token="**************", oauth_signature="*************************"
user-agent: Python-httplib2/0.20.2 (gzip)
accept-encoding: gzip, deflate
--===============5263540941563289710==
Content-Transfer-Encoding: base64
Content-Disposition: form-data; name="name"
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
dGVzdA==
--===============5263540941563289710==
Content-Transfer-Encoding: base64
Content-Disposition: form-data; name="level"
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
cmFpZC0w
--===============5263540941563289710==
Content-Transfer-Encoding: base64
Content-Disposition: form-data; name="block_devices"
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Wzg0OSw4NTBd
--===============5263540941563289710==--
And the base64 decode is giving us the right format, I really don’t understand what is going on…
Is it a bug ?
echo "Wzg0OSw4NTBd" | base64 -d
[849,850]
Thanks a lot if you can help