Skip to content

LocalCifsGroupMembers "post() cannot be used when 'records' is set... Use post_collection() instead." when adding local users to a group #56

@royui

Description

@royui

Since 9.18.1.0, posting LocalCifsGroupMembers records raises an error.

As stated in the documentation, adding local users to group should succeed:

    resource = LocalCifsGroupMembers(
        "179d3c85-7053-11e8-b9b8-005056b41bd1",
        "S-1-5-21-256008430-3394229847-3930036330-1001",
    )
    resource.records = [{"name": "user1"}, {"name": "user2"}]
    resource.post()

Trace :

  File "/netapp_ontap/resources/local_cifs_group_members.py", line 311, in post
    return super()._post(
  File "/netapp_ontap/utils.py", line 50, in wrapper
    return func(*args, **kwargs)
  File "/netapp_ontap/resource.py", line 1548, in _post
    self._check_for_post_collection_treatment()  # pylint: disable=protected-access
  File "/netapp_ontap/resource.py", line 2383, in _check_for_post_collection_treatment

netapp_ontap.error.NetAppRestError: post() cannot be used when 'records' is set on the object since it is used to create multiple records. Use post_collection() instead.

It works in 9.17.1.0 but fails in 9.18.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions