I'm not sure why you are getting the error shown from the code snippet you have highlighted. That error means that the field you are trying to access, hard_limit, is not populated in your local copy of the object.
Are you trying to access this field directly in later code? When I return my current QuotaReport list, that field isn't set by the API so I get the same error only when I try to access it:
>>> with HostConnection("x.x.x.x", username="yyyy", password="zzzz", verify=False):
2 for report in QuotaReport.get_collection(fields="*"):
3 print(report)
4 print(f"The hard limit is: {report.space.hard_limit}")
QuotaReport({'files': {'used': {'total': 0}}, 'index': 5764607523034234880, 'space': {'used': {'total': 0}}, 'svm': {'uuid': 'b72dc47d-9078-11ea-b848-005056bb7869', '_links': {'self': {'href': '/api/svm/svms/b72dc47d-9078-11ea-b848-005056bb7869'}}, 'name': 'vs1'}, 'type': 'tree', 'qtree': {'name': ''}, '_links': {'self': {'href': '/api/storage/quota/reports/b8e9e683-9078-11ea-b848-005056bb7869/5764607523034234880'}}, 'volume': {'uuid': 'b8e9e683-9078-11ea-b848-005056bb7869', '_links': {'self': {'href': '/api/storage/volumes/b8e9e683-9078-11ea-b848-005056bb7869'}}, 'name': 'vs1_root'}})
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "/home/pyenv3/lib/python3.7/site-packages/netapp_ontap/resource.py", line 191, in __getattribute__
) from None
AttributeError: The 'hard_limit' field has not been set on the QuotaReportSpace. Try refreshing the object by calling get().
The 'hard_limit' field has not been set on the QuotaReportSpace. Try refreshing the object by calling get().
>>>
If you want to account for some records that have it and some that don't, then you could change your code like this:
>>> with HostConnection("x.x.x.x", username="yyyy", password="zzzz", verify=False):
2 for report in QuotaReport.get_collection(fields="*"):
3 print(report)
4 print(f"The hard limit is: {getattr(report.space, 'hard_limit', 'not set')}")
QuotaReport({'files': {'used': {'total': 0}}, 'index': 5764607523034234880, 'space': {'used': {'total': 0}}, 'svm': {'uuid': 'b72dc47d-9078-11ea-b848-005056bb7869', '_links': {'self': {'href': '/api/svm/svms/b72dc47d-9078-11ea-b848-005056bb7869'}}, 'name': 'vs1'}, 'type': 'tree', 'qtree': {'name': ''}, '_links': {'self': {'href': '/api/storage/quota/reports/b8e9e683-9078-11ea-b848-005056bb7869/5764607523034234880'}}, 'volume': {'uuid': 'b8e9e683-9078-11ea-b848-005056bb7869', '_links': {'self': {'href': '/api/storage/volumes/b8e9e683-9078-11ea-b848-005056bb7869'}}, 'name': 'vs1_root'}})
The hard limit is: not set
>>>