Software Development Kit (SDK) and API Discussions

python Rest Api 9.7 new user quota fails

nicola_mendella

When trying to add a new user quota the error is:

 

"users" is a required input for creating a user rule and "group" is not allowed

 

The arguments passed are:

newquota = QuotaRule(users=[{'name': linname}] , svm={'name' : self.storage_controllers[self.site]['vserver']}, volume={'name':'vol_users'}, qtree={'name':'users'}, type='user',user_mapping="off", space={'hard_limit':new_quota_size})

 

From what i can see seems that the variable is not passed to the api request.

 

Python 3.6

netapp-ontap 9.7.2

 

Modify quotas works as expected.

Any suggestion ?

1 ACCEPTED SOLUTION

francoisbnc

Hi @nicola_mendella ,

 

It looks like a bug.

This is because the marshmallow schema for  QuotaReportUsersSchema doesn't allow postable field for name, even id.

So you can modify quota_report_users.py in the library like


class QuotaReportUsersSchema(ResourceSchema):
"""The fields of the QuotaReportUsers object"""

id = fields.Str(data_key="id")
r""" Quota target user ID """

name = fields.Str(data_key="name")
r""" Quota target user name """

@property
def resource(self):
return QuotaReportUsers

@property
def patchable_fields(self):
return [
]

@property
def postable_fields(self):
return ['name'
]

 

View solution in original post

2 REPLIES 2

francoisbnc

Hi @nicola_mendella ,

 

It looks like a bug.

This is because the marshmallow schema for  QuotaReportUsersSchema doesn't allow postable field for name, even id.

So you can modify quota_report_users.py in the library like


class QuotaReportUsersSchema(ResourceSchema):
"""The fields of the QuotaReportUsers object"""

id = fields.Str(data_key="id")
r""" Quota target user ID """

name = fields.Str(data_key="name")
r""" Quota target user name """

@property
def resource(self):
return QuotaReportUsers

@property
def patchable_fields(self):
return [
]

@property
def postable_fields(self):
return ['name'
]

 

View solution in original post

Thank You. This solved the issue.

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public