Skip to content

[Issue][Proxy environment variable] - krkn crashes when proxy environment variable does not contain "username:password" in the url #161

@jovik31

Description

@jovik31

Hello, I got a problem that leads to a crash in kraken when I try to run it with the http_proxy environment variable set but its value does not contain username and password, leading to the following error:

(chaos) [user@machine]$ python3 run_kraken.py --config test-config.yaml
2025-05-08 11:45:46,006 [INFO] Starting kraken
2025-05-08 11:45:46,010 [INFO] Initializing client to talk to the Kubernetes cluster
2025-05-08 11:45:46,010 [INFO] Generated a uuid for the run: 30335fb7-9718-4943-b57e-938b55a82ea0
Traceback (most recent call last):
File "//krkn/run_kraken.py", line 160, in main
kubecli = KrknKubernetes(kubeconfig_path=kubeconfig_path)
File "/
/krkn/chaos/lib64/python3.9/site-packages/krkn_lib/k8s/krkn_kubernetes.py", line 118, in init
self.__initialize_config(kubeconfig_path)
File "/***************************/krkn/chaos/lib64/python3.9/site-packages/krkn_lib/k8s/krkn_kubernetes.py", line 167, in __initialize_config
auth_string = proxy_auth.username + ":" + proxy_auth.password
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'


When the http_proxy url is parsed, if the username and password fields are not present in the url, the proxy_auth.username and proxy_auth.password are NoneType instead of an empty string as documented in the parser lib: https://docs.python.org/3/library/urllib.parse.html leading to the error displayed in the console.

In my specific scenario the proxy access does not require a username and password thus leading to this situation. If you could help me understand whether this is a bug or a miss configuration on my part I would appreciate it.

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions