You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from maas.client.bones import SessionAPI
>>> credentials=['zbL4fkkuxqxhDRauv9', 'tfymrvVay9qZGJFAR9', 'A4dJNDB8LUNFKUWx46gtCdhsVAg8aSkB']
>>> client = SessionAPI.fromURL(url="http://192.168.61.8:5240/MAAS/api/2.0/",credentials=credentials, insecure=True)
>>> client.SSHKeys.import(keysource='gh:canozyurt')
File "<stdin>", line 1
client.SSHKeys.import(keysource='gh:canozyurt')
^
SyntaxError: invalid syntax
>>>
I modified the API description json to export "import" action as "add" instead and published the json via 8080. I left the paths and URIs untouched so SessionAPI can still connect to the same MAAS instance.
{
"anon":null,
"auth":{
"actions":[
{
"method":"POST",
"name":"add",
"doc":"Import SSH keys\n\nImport the requesting user's SSH keys for a given protocol\nand authorization ID in protocol:auth_id format.\n\n:param keysource: Required. The source\nof the keys to import should be provided in the request payload as form\ndata:\n\nE.g.\n\n source:user\n\n- ``source``: lp (Launchpad), gh (GitHub)\n- ``user``: User login\n:type keysource: String\n\n ",
"op":"import",
"restful":false
},
{
"method":"GET",
"name":"read",
"doc":"List SSH keys\n\nList all keys belonging to the requesting user.\n\n",
"op":null,
"restful":true
},
{
"method":"POST",
"name":"create",
"doc":"Add a new SSH key\n\nAdd a new SSH key to the requesting or supplied user's\naccount.\n\n:param key: Required. A public SSH key\nshould be provided in the request payload as form data with the name\n'key':\n\n key: \"key-type public-key-data\"\n\n- ``key-type``: ecdsa-sha2-nistp256, ecdsa-sha2-nistp384,\n ecdsa-sha2-nistp521, ssh-dss, ssh-ed25519, ssh-rsa\n- ``public key data``: Base64-encoded key data.\n:type key: String\n\n ",
"op":null,
"restful":true
}
],
"doc":"Manage the collection of all the SSH keys in this MAAS.",
"name":"SSHKeysHandler",
"params":[
],
"path":"/MAAS/api/2.0/account/prefs/sshkeys/",
"uri":"http://192.168.61.8:5240/MAAS/api/2.0/account/prefs/sshkeys/"
},
"name":"SSHKeysHandler"
},
I modified the API description json to export "import" action as "add" instead and published the json via 8080. I left the paths and URIs untouched so SessionAPI can still connect to the same MAAS instance.
The request went through and returned success.
All other import actions available in other handlers seem affected too.
The text was updated successfully, but these errors were encountered: