imperva / imperva/imperva-sdk-python
for a missing license (say, product is only WAF licensed), the library is not gracefully treating errors
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
simple export functions error out:
> source_export = mx.export_to_json()
Traceback (most recent call last):
File "", line 1, in
source_export = mx.export_to_json()
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/MxConnection.py", line 2152, in export_to_json
site_dict = dict(site)
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/core.py", line 43, in __iter__
iters[child_title].append(dict(child))
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/core.py", line 40, in __iter__
children = get_all_function()
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/ServerGroup.py", line 198, in get_all_db_services
return self._connection.get_all_db_services(Site=self._Site, ServerGroup=self.Name)
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/MxConnection.py", line 411, in get_all_db_services
return DbService._get_all_db_services(connection=self, ServerGroup=ServerGroup, Site=Site)
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/DbService.py", line 100, in _get_all_db_services
res = connection._mx_api('GET', '/conf/dbServices/%s/%s' % (Site, ServerGroup))
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/MxConnection.py", line 257, in _mx_api
raise MxException("MX returned errors - %s" % str(error_message))
MxException: MX returned errors - [{'description': 'This feature is currently not licensed.', 'error-code': 'IMP-10129'}]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at export_to_json in MxConnection.py and follow the traceback through core.py, ServerGroup.py, and DbService.py to reproduce the unlicensed-feature response. Determine the expected graceful handling for IMP-10129 and verify that the export path no longer fails with the shown unhandled error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100