ONTAP Discussions

ontap api 98 quota error python

nicola_mendella
1,803 Views

from the documentation:

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
resource = QuotaReport(
index=4612248968380809216,
**{"volume.uuid": "cf480c37-2a6b-11e9-8513-005056a7657c"}
)
resource.get()
print(resource)

 

from a real system:

 

with HostConnection("10.54.126.30", username="admin", password="password", verify=False):
... resource = QuotaReport(
... index=2305843013508661248,
... **{"volume.uuid": "11b984a0-5fb7-11eb-848e-000c2933e33c"}
... )
... resource.get()
... print(resource)
...
Traceback (most recent call last):
File "<input>", line 6, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/netapp_ontap/resources/quota_report.py", line 1339, in get
return super()._get(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/netapp_ontap/utils.py", line 55, in wrapper
return on_api_fail(erro)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/netapp_ontap/utils.py", line 78, in on_api_fail
raise NetAppRestError(cause=erro) from None
netapp_ontap.error.NetAppRestError: Caused by HTTPError('404 Client Error: Not Found for url: https://10.54.126.30:443/api/storage/quota/reports/2305843013508661248',): "2305843013508661248" is an invalid value for field "volume.uuid" (<UUID>)

 

 

I made it working in this way:

 

resource = QuotaReport({"volume.uuid":"11b984a0-5fb7-11eb-848e-000c2933e33c"}, index='2305843013508661248')
resource.get()

 

But now the error is another one:

 

raceback (most recent call last):
File "<input>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/netapp_ontap/resources/quota_report.py", line 1339, in get
return super()._get(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/netapp_ontap/utils.py", line 51, in wrapper
return func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/netapp_ontap/resource.py", line 916, in _get
url = "%s%s" % (self.get_connection().origin, self.instance_location)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/netapp_ontap/resource.py", line 270, in __getattribute__
value = super().__getattribute__(name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/netapp_ontap/resource.py", line 442, in instance_location
return "%s/%s" % (self._location, "/".join(key_vals))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/netapp_ontap/resource.py", line 270, in __getattribute__
value = super().__getattribute__(name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/netapp_ontap/resource.py", line 402, in _location
raise NetAppRestError(message=msg, cause=exc) from None
netapp_ontap.error.NetAppRestError: Could not compute the location of the QuotaReport collection. Values for [] are required. Caused by TypeError('quote_from_bytes() expected bytes',)

 

 

on 9.7 this was working fine:

resource = QuotaReport(index=quota_index, volume=volume_name)

but not longer on 9.8

 

Is some bug or is it me doing it wrong ?

 

thanks

1 ACCEPTED SOLUTION

nicola_mendella
1,788 Views

I found the error

Apparently after updating the ontap_netapp pip library i did need to restart pycharm.

Now works like a charm

View solution in original post

1 REPLY 1

nicola_mendella
1,789 Views

I found the error

Apparently after updating the ontap_netapp pip library i did need to restart pycharm.

Now works like a charm

Public