#BUG in CLI resource in netapp-ontap python client library

1 messages · Page 1 of 1 (latest)

shrewd roost
#

In the resources/cli.py module there is a bug which causes the library to do a POST instead of GET for the command vserver export-policy check-access

The _parse_command(command) function only looks for show or status in the action_word in order to change the request type from POST to GET in the if statement

The reference code:

if "show" in action_word or "status" in action_word: # Need to add check-access here probably
        verb = "get"
        if action_word.startswith("show-"):
            everything_else.append("-".join(action_word.split("-")[1:]))
        elif action_word != "show":
            everything_else.append(action_word)
shrewd roost
mortal crystal
#

Ran into the same issue today but with the "options" command. Because it doesn't follow the normal ONTAP cluster shell command structure/syntax, CLI.execute was not playing nice.

My workaround was to add a dummy "show" after my command because I knew it would make sure a GET was performed and it would also be stripped from the API call.

This line:
response = CLI().execute("options show", option_name="lldp.enable", fields="option-value")

Rendered this API call which is exactly what I was after:
GET /api/private/cli/options?option_name=lldp.enable&fields=option-value&privilege_level=admin

shrewd roost
#

Nice