imperva / imperva/imperva-sdk-python

delete non-empty action-set; create it again - the GUI shows it empty; add the same action: although GUI shows action-set empty, trying to add the action to the action-set from API fails with message: action already exists on action-set

Open
#43 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
14
Forks
10
PR merge metrics
No merged PRs in 30d

Description

`
mx.logout()

del mx

if 'mx' not in locals() or not mx.IsAuthenticated:
mx = impv.MxConnection(url, Port=443, Username=user, Password=passw)

mx.get_action_set(Name=gwActionSetName)
Out[311]:

mx.get_action(Name=gwActionName, ActionSet=gwActionSetName)

mx.create_action(Name=gwActionName,ActionType='GWSyslog',Protocol=gwSyslogProtocol,Port=gwSysLogSrvPort,Host=gwSysLogSrvIP,ActionSet=gwActionSetName,SyslogLogLevel='INFO',SyslogFacility='USER',Message=sysLogMessage,ActionInterface=actionInterface)
Out[313]:

mx.delete_action(Name=gwActionName,ActionSet=gwActionSetName)
Out[314]: True

mx.create_action(Name=gwActionName,ActionType='GWSyslog',Protocol=gwSyslogProtocol,Port=gwSysLogSrvPort,Host=gwSysLogSrvIP,ActionSet=gwActionSetName,SyslogLogLevel='INFO',SyslogFacility='USER',Message=sysLogMessage,ActionInterface=actionInterface)
Out[315]:

mx.delete_action_set(Name=gwActionSetName)
Out[316]: True

mx.create_action_set(Name=gwActionSetName, AsType='security',update=True)
Out[317]:

mx.create_action(Name=gwActionName,ActionType='GWSyslog',Protocol=gwSyslogProtocol,Port=gwSysLogSrvPort,Host=gwSysLogSrvIP,ActionSet=gwActionSetName,SyslogLogLevel='INFO',SyslogFacility='USER',Message=sysLogMessage,ActionInterface=actionInterface)
Traceback (most recent call last):

File "", line 3, in
mx.create_action(Name=gwActionName,ActionType='GWSyslog',Protocol=gwSyslogProtocol,Port=gwSysLogSrvPort,Host=gwSysLogSrvIP,ActionSet=gwActionSetName,SyslogLogLevel='INFO',SyslogFacility='USER',Message=sysLogMessage,ActionInterface=actionInterface)

File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/MxConnection.py", line 879, in create_action
return Action._create_action(connection=self, Name=Name, ActionSet=ActionSet, ActionType=ActionType, Protocol=Protocol, SyslogFacility=SyslogFacility, Host=Host, SyslogLogLevel=SyslogLogLevel, SecondaryPort=SecondaryPort, ActionInterface=ActionInterface, SecondaryHost=SecondaryHost, Message=Message, Port=Port, update=update)

File "/anaconda3/lib/python3.7/site-packages/imperva_sdk-0.2.0-py3.7.egg/imperva_sdk/Action.py", line 194, in _create_action
raise MxException("Action '%s' already exists" % Name)

MxException: Action 'GWSyslog' already exists

`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with imperva_sdk/MxConnection.py around create_action and imperva_sdk/Action.py around _create_action, using the reproduced delete and recreate sequence as the entry point. Trace how action-set contents are checked after deletion; done means recreating the action set permits adding the same action without the "already exists" error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.