F5Networks / k8s-bigip-ctlr

Repository for F5 Container Ingress Services for Kubernetes & OpenShift.
Apache License 2.0
357 stars 195 forks source link

Improve log message when partition is not found #3190

Closed alonsocamaro closed 7 months ago

alonsocamaro commented 10 months ago

Title

Title of the feature/enhancement request

Description

This is what it is shown when a partition is not present:

2023/12/13 11:41:48 [DEBUG] [2023-12-13 11:41:48,089 icontrol.session DEBUG] get WITH uri: https://10.1.1.8:443/mgmt/tm/auth/partition/sc-onetier AND suffix:  AND kwargs: {}
2023/12/13 11:41:48 [DEBUG] [2023-12-13 11:41:48,090 urllib3.connectionpool DEBUG] Resetting dropped connection: 10.1.1.8
2023/12/13 11:41:48 [DEBUG] [2023-12-13 11:41:48,135 urllib3.connectionpool DEBUG] https://10.1.1.8:443 "GET /mgmt/tm/auth/partition/sc-onetier HTTP/1.1" 404 117
2023/12/13 11:41:48 [INFO] Text: '{"code":404,"message":"01020036:3: The requested partition (sc-onetier) was not found.","errorStack":[],"apiError":3}'
2023/12/13 11:41:48 [DEBUG] [2023-12-13 11:41:48,136 icontrol.session DEBUG] RESPONSE::STATUS: 404 Content-Type: application/json; charset=UTF-8 Content-Encoding: None
2023/12/13 11:41:48 [ERROR] [2023-12-13 11:41:48,136 __main__ ERROR] Unexpected error
2023/12/13 11:41:48 [INFO] Traceback (most recent call last):
2023/12/13 11:41:48 [INFO]   File "/app/src/f5-ctlr-agent/f5_ctlr_agent/bigipconfigdriver.py", line 371, in _do_reset
2023/12/13 11:41:48 [INFO]     incomplete = self._update_cccl(config)
2023/12/13 11:41:48 [INFO]                  ^^^^^^^^^^^^^^^^^^^^^^^^^
2023/12/13 11:41:48 [INFO]   File "/app/src/f5-ctlr-agent/f5_ctlr_agent/bigipconfigdriver.py", line 500, in _update_cccl
2023/12/13 11:41:48 [INFO]     incomplete += mgr._apply_net_config(cfg_net)
2023/12/13 11:41:48 [INFO]                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/12/13 11:41:48 [INFO]   File "/app/src/f5-ctlr-agent/f5_ctlr_agent/bigipconfigdriver.py", line 136, in _apply_net_config
2023/12/13 11:41:48 [INFO]     return self._cccl.apply_net_config(config)
2023/12/13 11:41:48 [INFO]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/12/13 11:41:48 [INFO]   File "/app/src/f5-cccl/f5_cccl/api.py", line 102, in apply_net_config
2023/12/13 11:41:48 [INFO]     return self._service_manager.apply_net_config(services)
2023/12/13 11:41:48 [INFO]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/12/13 11:41:48 [INFO]   File "/app/src/f5-cccl/f5_cccl/service/manager.py", line 715, in apply_net_config
2023/12/13 11:41:48 [INFO]     default_route_domain = self._bigip.get_default_route_domain()
2023/12/13 11:41:48 [INFO]                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/12/13 11:41:48 [INFO]   File "/app/src/f5-cccl/f5_cccl/bigip.py", line 449, in get_default_route_domain
2023/12/13 11:41:48 [INFO]     partition = self._bigip.tm.auth.partitions.partition.load(
2023/12/13 11:41:48 [INFO]                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/12/13 11:41:48 [INFO]   File "/usr/local/lib/python3.11/site-packages/f5/bigip/resource.py", line 1110, in load
2023/12/13 11:41:48 [INFO]     return self._load(**kwargs)
2023/12/13 11:41:48 [INFO]            ^^^^^^^^^^^^^^^^^^^^
2023/12/13 11:41:48 [INFO]   File "/usr/local/lib/python3.11/site-packages/f5/bigip/resource.py", line 1084, in _load
2023/12/13 11:41:48 [INFO]     response = refresh_session.get(base_uri, **kwargs)
2023/12/13 11:41:48 [INFO]                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023/12/13 11:41:48 [INFO]   File "/usr/local/lib/python3.11/site-packages/icontrol/session.py", line 295, in wrapper
2023/12/13 11:41:48 [INFO]     raise iControlUnexpectedHTTPError(error_message, response=response)
2023/12/13 11:41:48 [INFO] icontrol.exceptions.iControlUnexpectedHTTPError: 404 Unexpected Error: Not Found for uri: https://10.1.1.8:443/mgmt/tm/auth/partition/sc-onetier
2023/12/13 11:41:48 [INFO] Text: '{"code":404,"message":"01020036:3: The requested partition (sc-onetier) was not found.","errorStack":[],"apiError":3}'

Actual Problem

The error message is not user readable

Solution Proposed

trinaths commented 9 months ago

Created [CONTCNTR-4368] for internal tracking.

trinaths commented 7 months ago

Closing this issue.