Software Development Kit (SDK) and API Discussions

python Rest Api 9.7 new user quota fails

nicola_mendella
2,462 Views

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
2,415 Views

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
2,416 Views

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'
]

 

nicola_mendella
2,335 Views

Thank You. This solved the issue.

Public