Hello, im am receiving the following error while trying to pull quota policy rules.
------------------------------
Traceback (most recent call last):
File "qrule.py", line 21, in <module>
quota.get(fields='*')
File "/opt/netapp/py/.venv/lib/python3.8/site-packages/netapp_ontap/resources/quota_rule.py", line 921, in get
return super()._get(**kwargs)
File "/opt/netapp/py/.venv/lib/python3.8/site-packages/netapp_ontap/utils.py", line 51, in wrapper
return func(*args, **kwargs)
File "/opt/netapp/py/.venv/lib/python3.8/site-packages/netapp_ontap/resource.py", line 1308, in _get
self._parse_json_response(response)
File "/opt/netapp/py/.venv/lib/python3.8/site-packages/netapp_ontap/resource.py", line 1675, in _parse_json_response
self._clone_from_dict(response_dict)
File "/opt/netapp/py/.venv/lib/python3.8/site-packages/netapp_ontap/resource.py", line 1732, in _clone_from_dict
self.__dict__ = self.from_dict( # pylint: disable=attribute-defined-outside-init
File "/opt/netapp/py/.venv/lib/python3.8/site-packages/netapp_ontap/resource.py", line 568, in from_dict
raise NetAppRestError(cause=exc) from None
netapp_ontap.error.NetAppRestError: Caused by ValidationError({'space': {'soft_limit': ['"-" could not be interpreted as an integer or a valid size. Valid size values are of the form \\d+[KB|MB|GB|TB|PB].You must pass either a valid size string or an integer for soft_limit.']}, 'files': {'soft_limit': ['"-" could not be interpreted as an integer or a valid size. Valid size values are of the form \\d+[KB|MB|GB|TB|PB].You must pass either a valid size string or an integer for soft_limit.'], 'hard_limit': ['"-" could not be interpreted as an integer or a valid size. Valid size values are of the form \\d+[KB|MB|GB|TB|PB].You must pass either a valid size string or an integer for hard_limit.']}})
i assume it is because of this:
"space": {
"hard_limit": 130996502528,
"soft_limit": "-"
},
"files": {
"hard_limit": "-",
"soft_limit": "-"
but the thing is that we are never setting those limits, just hard_limit and the "-" is there by default . this is causing failures during our reports and automation process . any idea how to skip those parameters from being retrieved ? i have found a way with try and except but that is causing for qtree's to be skipped and being left out of the report/automation process .
from netapp_ontap import HostConnection, utils
from netapp_ontap.resources import QuotaRule
from netapp_ontap.error import NetAppRestError
import json,
import pprint
import logging
logging.basicConfig(level=logging.DEBUG)
utils.LOG_ALL_API_CALLS = 1
ctrl='c01'
vserver='svm02'
filename = 'file.json'
with HostConnection(ctrl, username="", password="", verify=False) :
lQuotas = []
for quota in QuotaRule.get_collection():
#try:
quota.get(fields='*')
lQuotas.append(quota.to_dict())
#except NetAppRestError as exc:
# if exc.http_err_response:
# print(">>>> err found in "+str(quota))
#continue
#raise exc
with open(filename, 'w') as file_in:
json.dump(lQuotas, file_in, indent = 4)
thanks in advance!