imperva / imperva/imperva-sdk-python
strange condition: Server Group already exists when trying to create it, but then Server Group not found when trying to delete it
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
code:
`
mx.IsAuthenticated
Out[170]: True
site = mx.get_site('10x')
site.create_server_group(serverGroup, update=False)
Traceback (most recent call last):
File "", line 1, in
site.create_server_group(serverGroup, update=False)
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/Site.py", line 113, in create_server_group
return self._connection.create_server_group(Name=Name, Site=self.Name, OperationMode=OperationMode, ProtectedIps=ProtectedIps, ServerIps=ServerIps, update=update)
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/MxConnection.py", line 330, in create_server_group
return ServerGroup._create_server_group(connection=self, Name=Name, Site=Site, OperationMode=OperationMode, ProtectedIps=ProtectedIps, ServerIps=ServerIps, update=update)
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/ServerGroup.py", line 146, in _create_server_group
raise MxException("Server Group already exists")
MxException: Server Group already exists
site.delete_server_group(serverGroup)
Traceback (most recent call last):
File "", line 1, in
site.delete_server_group(serverGroup)
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/Site.py", line 116, in delete_server_group
return self._connection.delete_server_group(Name=Name, Site=self.Name)
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/MxConnection.py", line 341, in delete_server_group
return ServerGroup._delete_server_group(connection=self, Name=Name, Site=Site)
File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/ServerGroup.py", line 161, in _delete_server_group
connection._mx_api('DELETE', '/conf/serverGroups/%s/%s' % (Site, Name))
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': 'Server Group not found', 'error-code': 'IMP-10008'}]
`
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 by reproducing the create and delete calls shown in the issue, then inspect imperva_sdk/ServerGroup.py methods _create_server_group and _delete_server_group, along with the Site.py and MxConnection.py call paths. Determine why the API reports conflicting existence states and establish the expected behavior for the same Server Group before validating a fix.
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