Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use LocalCifsGroupMembers #47

Closed
albinpopote opened this issue Feb 20, 2024 · 4 comments
Closed

Unable to use LocalCifsGroupMembers #47

albinpopote opened this issue Feb 20, 2024 · 4 comments

Comments

@albinpopote
Copy link

Hello,

I try to use the LocalCifsGroupMembers class to associate local user(s) from an SVM to a local group (cifs workgroup).
Based on the documentation: https://library.netapp.com/ecmdocs/ECMLP2885777/html/resources/local_cifs_group_members.html#overview, I try to simply get information of members on my local group "cifs_group":

print(list(LocalCifsGroup.get_collection(fields="*", **{"svm.name": 'test_svm'})))
--> [LocalCifsGroup({'_links': {'self': {'href': 'xxxx'}}, 'name': 'SVM_TEST_01\\cifs_group', 'sid': 'S-1-5-21-1704451965-2597020852-3779635676-1001', 'svm': {'_links': {'self': {'href': 'xxxx'}}, 'name': 'test_svm', 'uuid': '60f0f740-cf56-11ee-a9e3-00a098a97a62'}})]

When I try to request the LocalCifsGroupMembers with group SID:
print(list(LocalCifsGroupMembers.get_collection("S-1-5-21-1704451965-2597020852-3779635676-1001")))

I got the following NetAppRestError:
Could not compute the location of the LocalCifsGroupMembers collection. Values for ['svm.uuid', 'local_cifs_group.sid'] are required. Caused by AttributeError("'LocalCifsGroupMembers' object has no attribute 'svm'")

I've tried to pass the SID from user in place of the group SID, the complete local group response object, svm.uuid and local_cifs_group.sid as parameters but I got always the same error....

Environment:
netapp-ontap 9.14.1.0
NetApp Release 9.11.1P12: Fri Sep 22 11:58:50 UTC 2023

Regards ^^

Copy link

Thank you for reporting an issue! If you haven't already joined our Discord community,
then we invite you to do so. This is a great place to get help and ask questions from our community.

@noorbuchi
Copy link
Contributor

noorbuchi commented Feb 20, 2024

Hi @albinpopote,

It looks like the example in the official netapp_ontap documentation page is incorrect. You need to pass the SVM uuid as well as the local_cifs_group sid. The code would then look something like this:

print(list(LocalCifsGroupMembers.get_collection("<svm_uuid>", "<local_cifs_group.sid>")))

You can also refer to the official REST API documentation where the same example exists correctly using curl

https://docs.netapp.com/us-en/ontap-restapi//ontap/protocols_cifs_local-groups_svm.uuid_local_cifs_group.sid_members_endpoint_overview.html#overview

Can you please try that out and let us know if it works. Thanks!

Best,
Noor

@albinpopote
Copy link
Author

Hello @noorbuchi,

Yes It works if you pass directly the arguments (*args) to the get_collection.
It doesn't work if you try to use kwargs arguments on the get_collection function:

print(list(LocalCifsGroupMember.get_collection(**{'svm.uuid': '<svm_uuid>', 'local_cifs_group.sid': '<local_cifs_group.sid>'})

Thks for your help ^^

@noorbuchi
Copy link
Contributor

Glad to hear that it works!

For get_collection, netapp_ontap expects that all parent keys/path keys to be provided as *args. On the other hand, values passed as **kwargs are sent as query parameters in the REST request. I hope this clears it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants