Skip to content
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]: Can not update Sub-Location options. #198

Closed
shuangqingliCN opened this issue May 10, 2023 · 2 comments
Closed

[BUG]: Can not update Sub-Location options. #198

shuangqingliCN opened this issue May 10, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@shuangqingliCN
Copy link

while using zia.locations.update_location update sub-location options get an error:
zia.locations.update_location(location_id='70579512',surrogate_ip='True',idle_time_in_minutes='480',surrogate_ip_enforced_for_known_browsers='True',surrogate_refresh_time_in_minutes='480')

restfly.errors.ServerError: [500: PUT] https://zsapi.zscaler.net/api/v1/locations/70579512 body=b'{"code":"UNEXPECTED_ERROR","message":"An unexpected error has occurred, please contact Zscaler's support"}'

while using zia.locations.update_location update main-location options works fine:
zia.locations.update_location('33743832',surrogate_ip='True',idle_time_in_minutes='480',surrogate_ip_enforced_for_known_browsers='True',surrogate_refresh_time_in_minutes='480')

Locations:
Main:
{'id': 33743832, 'name': 'AIA_Roaming_Users', 'non_editable': False, 'parent_id': 0, 'up_bandwidth': 1024000, 'dn_bandwidth': 1024000, 'override_up_bandwidth': 0, 'override_dn_bandwidth': 0, 'shared_up_bandwidth': 1024000, 'shared_down_bandwidth': 1024000, 'unused_up_bandwidth': 0, 'unused_dn_bandwidth': 0, 'country': 'NONE', 'language': 'NONE', 'tz': 'GMT', 'geo_override': False, 'latitude': 0.0, 'longitude': 0.0, 'ports': [10938], 'auth_required': True, 'ssl_scan_enabled': True, 'zapp_ssl_scan_enabled': True, 'xff_forward_enabled': True, 'other_sub_location': False, 'ec_location': False, 'surrogate_ip': True, 'idle_time_in_minutes': 60, 'display_time_unit': 'HOUR', 'surrogate_ip_enforced_for_known_browsers': True, 'surrogate_refresh_time_in_minutes': 60, 'surrogate_refresh_time_unit': 'HOUR', 'kerberos_auth': False, 'digest_auth_enabled': False, 'ofw_enabled': True, 'ips_control': True, 'aup_enabled': False, 'caution_enabled': False, 'aup_block_internet_until_accepted': False, 'aup_force_ssl_inspection': False, 'iot_discovery_enabled': False, 'aup_timeout_in_days': 0, 'child_count': 2, 'match_in_child': False, 'static_location_groups': [{'id': 43845168, 'name': 'Locations_SSL_CltCon_Enforce'}, {'id': 43845169, 'name': 'Locations_SSL'}], 'dynamiclocation_groups': [{'id': 43779439, 'name': 'Corporate User Traffic Group'}], 'exclude_from_dynamic_groups': False, 'exclude_from_manual_groups': False, 'profile': 'CORPORATE'}
Sub belongs to main:
{'id': 70579512, 'name': 'PPC0005506', 'non_editable': False, 'parent_id': 33743832, 'up_bandwidth': 0, 'dn_bandwidth': 0, 'country': 'CHINA', 'language': 'NONE', 'tz': 'GMT', 'geo_override': False, 'latitude': 0.0, 'longitude': 0.0, 'ip_addresses': ['61.152.197.26'], 'auth_required': True, 'ssl_scan_enabled': False, 'zapp_ssl_scan_enabled': False, 'xff_forward_enabled': True, 'other_sub_location': False, 'ec_location': False, 'surrogate_ip': False, 'idle_time_in_minutes': 0, 'surrogate_ip_enforced_for_known_browsers': False, 'surrogate_refresh_time_in_minutes': 0, 'kerberos_auth': False, 'digest_auth_enabled': False, 'ofw_enabled': True, 'ips_control': False, 'aup_enabled': False, 'caution_enabled': False, 'aup_block_internet_until_accepted': False, 'aup_force_ssl_inspection': False, 'iot_discovery_enabled': False, 'aup_timeout_in_days': 0, 'child_count': 0, 'match_in_child': False, 'static_location_groups': [{'id': 43845169, 'name': 'Locations_SSL'}
...

@shuangqingliCN shuangqingliCN added the bug Something isn't working label May 10, 2023
@mitchos
Copy link
Owner

mitchos commented Jun 2, 2023

Hi @shuangqingliCN

I'll try take a look at this over the next few days, I haven't seen this one before so I'll try replicate it first. Will keep you updated.

@mitchos
Copy link
Owner

mitchos commented Jun 2, 2023

Okay I found your problem, pretty annoying one to be honest. I had to update a sublocation in the ZIA web UI and then compare their data structure to the one pyZscaler is creating. I tried every missing field one by one until i found it:

You will get the 500 error unless you specify: display_time_unit=<unit>

So the below worked for me:

                                   auth_required=True,
                                    surrogate_ip=True,
                                    idle_time_in_minutes='480',
                                    surrogate_ip_enforced_for_known_browsers=True,
                                    surrogate_refresh_time_in_minutes='480',
                                    surrogate_refresh_time_unit='MINUTE',
                                    display_time_unit='MINUTE',

What I'll do is I'll update the code to include that value automatically in case its not provided.

Thanks for finding that one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants