ansible-collections / netapp.ontap

Ansible collection to support NetApp ONTAP configuration.
https://galaxy.ansible.com/netapp/ontap
GNU General Public License v3.0
55 stars 35 forks source link

"system license show-status" not working for ONTAP 9.8 via na_ontap_rest_cli module #160

Closed lorenzo-maffeo-SAP closed 8 months ago

lorenzo-maffeo-SAP commented 1 year ago

Summary

When attempting to write a tast using na_ontap_rest_cli to call "system license show-status" agains a system running 9.8, an error is returned mentioning 'API not found'

Component Name

na_ontap_rest_cli

Ansible Version

$ ansible --version
ansible 2.9.6

ONTAP Collection Version

$ ansible-galaxy collection list
netapp.ontap 21.15.1

ONTAP Version

:> version
NetApp Release 9.8P16: Fri Dec 02 02:05:05 UTC 2022

Playbook

tasks:
    - name: Get cluster information
      connection: local
      na_ontap_rest_cli:
        command: 'system/license/show-status'
        verb: GET
        params: {'status': 'partially-installed'}
      register: cluster_info

Steps to Reproduce

Create a new playbook with a this single task and an inventory of 2 systems (one running 9.8 and one running 9.10)

  tasks:
    - name: Get cluster information
      connection: local
      na_ontap_rest_cli:
        command: 'system/license/show-status'
        verb: GET
        params: {'status': 'partially-installed'}
      register: cluster_info

Expected Results

I expected the task to complete successfully since the command is available in ONTAP 9.8 and na_ontap_rest_cli module can be used with ONTAP 9.6+

Actual Results

fatal: [X.X.X.X]: FAILED! => {"changed": false, "msg": "Error: {'message': 'API not found', 'code': '3'}"}

---- 
ONTAP audit log shows
Sat Jun 17 08:12:29 2023  [redacted] :: GET /api/private/cli/system/license/show-status?status=partially-installed :: Pending
Sat Jun 17 08:12:29 2023  [redacted] GET /api/private/cli/system/license/show-status?status=partially-installed :: Error: invalid operation
lorenzo-maffeo-SAP commented 1 year ago

this issue occurs with many more commands when attempting to run them through na_ontap_rest_cli:

- name: Get volume information
  connection: local
  na_ontap_rest_cli:
    command: 'storage/volume/show'
    verb: GET
    <<: *login

fatal: [x.x.x.x]: FAILED! => {"changed": false, "msg": "Error: {'message': 'API not found', 'code': '3'}"}

 - name: Get snapmirror information
  connection: local
  na_ontap_rest_cli:
    command: 'snapmirror/show'
    verb: GET
    <<: *login

fatal: [x.x.x.x]: FAILED! => {"changed": false, "msg": "Error: {'message': 'API not found', 'code': '3'}"}

while I know that I can use gather_info of rest_info module, it will not serve the purpose I'm trying to achieve as it does not present all information it should, e.g. storage/volumes does not present any information about any volume encryption, and 'snapmirror/relationships' does not show any LS Mirror relationship

lorenzo-maffeo-SAP commented 1 year ago

This documentation has rules for forming cli path. - https://library.netapp.com/ecmdocs/ECMLP2885799/html/index.html (look for section "Using the private CLI passthrough with the ONTAP REST API")

I am guessing these changes will work.

snapmirror/show -> snapmirror storage/volume/show -> storage/volume system/license/show-status -> system/license/status

Thanks for the reply, I have missed that part of the documentation. Snapmirror and volumes were a false alarm. Still, system license status and system license show-status are different commands which provide different information. For my purpose (identifying licensing mismatch across nodes) I require the output of the second one which does not seem to work on 9.8. The CLI command, on the other hand, works as expected.

cluster::> system license show-status -status partially-installed
There are no entries matching your query.

cluster::> version
NetApp Release 9.8P16: Fri Dec 02 02:05:05 UTC 2022
carchi8py commented 1 year ago

Do any of the examples in the "Using the private CLI passthrough with the ONTAP REST API" work?

https://library.netapp.com/ecmdocs/ECMLP2885799/html/index.html#/