#Add missing api calls to na_ontap_rest_i...
1 messages · Page 1 of 1 (latest)
Let me check what going on. But It shouldn't be add to the main list like that.
We have a special function that will add all the resources that require an owning_resource
@void dagger it works for me.... but i also think i recreated your issue.
If the SVM name you give dosn't exist on the host, we fail in that way
I ran the following playbook
`-
name: Test owning_resource
hosts: localhost
gather_facts: no
collections:
- netapp.ontap
vars:
module_defaults:
group/netapp.ontap.netapp_ontap:
hostname:
username:
password:
https: true
validate_certs: false
tasks:
- name: Get vscan
na_ontap_rest_info:
gather_subset:
- protocols/vscan/scanner-pools
owning_resource:
svm_name: ansibleSVM
- name: Get vscan
na_ontap_rest_info:
gather_subset:
- protocols/vscan/on-access-policies
owning_resource:
svm_name: ansibleSVM
- name: Get vscan
na_ontap_rest_info:
gather_subset:
- protocols/vscan/on-demand-policies
owning_resource:
svm_name: ansibleSVM
- name: Get vscan
na_ontap_rest_info:
gather_subset:
- protocols/vscan/on-demand-policies
owning_resource:
svm_name: none-existent-svm`
The first 3 play worked and gave back data, the last one with the SVM name that dosn't exist fail in the same way you saw.
So on my side i'll need to add an error to check that the svm name exist on the server and if not fail with a message
Hi Chris,
Thank you for the update. Could you please check what happens if you run it against the Admin SVM?
Good catch.
So data SVM works, Admin SVM does not.
he full traceback is: File "/var/folders/zv/gm9l2n2n30g2k5tdmny65l_r0000gp/T/ansible_na_ontap_rest_info_payload_u7n3nsh0/ansible_na_ontap_rest_info_payload.zip/ansible_collections/netapp/ontap/plugins/modules/na_ontap_rest_info.py", line 765, in get_ontap_subset_info_all fatal: [localhost]: FAILED! => { "changed": false, "invocation": { "module_args": { "cert_filepath": null, "feature_flags": {}, "fields": null, "force_ontap_version": null, "gather_subset": [ "protocols/vscan/scanner-pools" ], "hostname": "10.193.179.179", "http_port": null, "https": true, "ignore_api_errors": null, "key_filepath": null, "max_records": 1024, "ontapi": null, "owning_resource": { "svm_name": "ontap97" }, "parameters": null, "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "state": null, "use_python_keys": false, "use_rest": "auto", "username": "admin", "validate_certs": false } }, "msg": "Specified subset protocols/vscan/scanner-pools is not found, supported subsets are ['application/applications', 'application/consistency-groups', 'application/templates', 'cloud/targets', 'cluster', 'cluster/chassis', 'cluster/counter/tables',
@void dagger i had to dig through the code but i see what happening. I don't think we can do this with the admin api.
Because we don't expect the user to know the SVM UUID our first REST API call is going to be to svm/svms to get the UUID from the svm_name
When using the Admin api (and also a svm that dosn't exist). We hit a weird situation i wasn't expecting
https://github.com/ansible-collections/netapp.ontap/blob/main/plugins/module_utils/rest_vserver.py#L49
On line 54 both record and error end up being None.
I made an assumption when i wrote this, that we would never hit this, so left error_on_none to the default of False, but it should be true in this case
So when you run this as the admin api you would get an error of
Error vserver <vserver name> not found
@uneven sorrel Yes, that's true. I hit this error. So, if I need the information from the Admin SVM, I have to use the cli modules right?
Let me check with the #┊・ontap-api team. Right now it looks like the admin svm can't make svm/svms calls. For us that mean we can't get the SVN UUID that needed for the call to https://library.netapp.com/ecmdocs/ECMLP2882307/html/index.html#/NAS/vscan_scanner_collection_get
If this is the case would adding passing in the svn.uuid work for you guys instead of the name. I don't really like that idea as having the UUID in the playbook as it meaning less to the end user and no one going to remeber 1cd8a442-86d1-11e0-ae1c-123478563412" = svm2....