-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: Unable to delete udp/tcp ports in app segment #189
Comments
Hi @martinkiska sorry for the long time on this one, I am clearing the backlog up now and will take a look at this. |
Hello. Any updates here? I have the same issue. |
I can just share with you my very easy workaround in update_app function.
This easy code if it doesn't find tcp/udp port configured in my own YAML structure it just adds empty tcp/udp info via kwargs and it correctly zeroize it in cloud. |
Hi @martinkiska Thank you for your answer, but still I would like to have a working module, not a workaround. |
Describe the bug
SDK is natively unable to zeroize/delete tcp/udp port config, if empty list is send to update function.
To Reproduce
Steps to reproduce the behavior:
send tcp_ports/udp_ports = [] as kwarg to update_segment and try to delete UDP/TCP port config in cloud.
Expected behavior
if empty list is sent I would expect, that SDK would delete port config from specific app segment
Screenshots
app definition in cloud:
[{'name': 'TEST_testing3', 'domain_names': ['example.tld'], 'tcp_port_ranges': ['80', '80', '443', '443'], 'tcp_port_range': [{'from': '80', 'to': '80'}, {'from': '443', 'to': '443'},'udp_port_ranges': ['80', '80', '443', '443'], 'udp_port_range': [{'from': '80', 'to': '80'}, {'from': '443', 'to': '443'}}]
image situation that someone configured app in GUI, but you want to keep SSoT in git YAML format and update this app and remove udp port config as there is none specified in SSoT YAML format.
testing app format being passed to update_segment():
[{'name': 'TEST_testing3', 'domain_names': ['example.tld'], 'tcp_ports':[(80,80),(443,443)],'udp_ports':[]}]
As here you will omit that empty value, it will not be processed
pyZscaler/pyzscaler/zpa/app_segments.py
Lines 230 to 231 in 4502dc8
kwargs will be later on updated from payload gathered in
pyZscaler/pyzscaler/zpa/app_segments.py
Line 225 in 4502dc8
Kwargs passed to function:
pyZscaler/pyzscaler/zpa/app_segments.py
Lines 237 to 238 in 4502dc8
That means that you will update kwargs from payload, what will keep it UDP ports configured.
My current workaround is to send {'udp_port_range':[],'udp_port_ranges':[]} directly to update_segment function. Due to existence of those keys script will later on override them in the payload. I already opened an ticket in past and both va
pyZscaler/pyzscaler/zpa/app_segments.py
Line 160 in 4502dc8
Just an hint, it is not enough just to send empty value for udp_port_range, it needs both values to equals to []
Current issue is that with native options of SDK there is no option to keep udp/tcp ports synced from git (yaml) to gui (ensure that there is empty value in cloud)
The text was updated successfully, but these errors were encountered: