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

Error with api when set configuration assert_hostname as true #2253

Open
Azteker opened this issue Jun 29, 2024 · 0 comments
Open

Error with api when set configuration assert_hostname as true #2253

Azteker opened this issue Jun 29, 2024 · 0 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@Azteker
Copy link

Azteker commented Jun 29, 2024

When I set assert_hostname of client configuration as true,

configuration = client.Configuration()
configuration.assert_hostname = True

I got the following error

Traceback (most recent call last):                                                                                                                                                     
   File "/usr/src/app/my_portal/common/k8sapi.py", line 949, in get_cluster_usage                                                                                                   
     metrics_list = custom_objects_api.list_cluster_custom_object(group, version, resource)                                                                                             
   File "/usr/local/lib/python3.9/site-packages/kubernetes/client/api/custom_objects_api.py", line 2065, in list_cluster_custom_object                                                  
     return self.list_cluster_custom_object_with_http_info(group, version, plural, **kwargs)  # noqa: E501                                                                              
   File "/usr/local/lib/python3.9/site-packages/kubernetes/client/api/custom_objects_api.py", line 2196, in list_cluster_custom_object_with_http_info                                   │
     return self.api_client.call_api(                                                                                                                                                   
   File "/usr/local/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 348, in call_api                                                                                 
     return self.__call_api(resource_path, method,                                                                                                                                      
   File "/usr/local/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 180, in __call_api                                                                               
     response_data = self.request(                                                                                                                                                      
   File "/usr/local/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 373, in request                                                                                  
     return self.rest_client.GET(url,                                                                                                                                                   
   File "/usr/local/lib/python3.9/site-packages/kubernetes/client/rest.py", line 241, in GET                                                                                            
     return self.request("GET", url,                                                                                                                                                    
   File "/usr/local/lib/python3.9/site-packages/kubernetes/client/rest.py", line 214, in request                                                                                        
     r = self.pool_manager.request(method, url,                                                                                                                                         
   File "/usr/local/lib/python3.9/site-packages/urllib3/request.py", line 77, in request                                                                                                
     return self.request_encode_url(                                                                                                                                                    
   File "/usr/local/lib/python3.9/site-packages/urllib3/request.py", line 99, in request_encode_url                                                                                     
     return self.urlopen(method, url, **extra_kw)                                                                                                                                       
  File "/usr/local/lib/python3.9/site-packages/urllib3/poolmanager.py", line 376, in urlopen                                                                                           
     response = conn.urlopen(method, u.request_uri, **kw)                                                                                                                               
   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 715, in urlopen                                                                                        
     httplib_response = self._make_request(                                                                                                                                               
   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 404, in _make_request                                                                                       
     self._validate_conn(conn)                                                                                                                                                             
   File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1058, in _validate_conn                                                                                     
     conn.connect()                                                                                                                                                                        
   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 472, in connect                                                                                                 
      _match_hostname(cert, self.assert_hostname or server_hostname)                                                                              
   File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 540, in _match_hostname                                                                                         
      stripped_hostname = asserted_hostname.strip("u[]")
AttributeError: 'bool' object has no attribute 'strip'                                                                                                   

As your spec assert_hostname should be a bool, but seems urllib3 expect assert_hostname to be a string instead of bool

@Azteker Azteker added the kind/bug Categorizes issue or PR as related to a bug. label Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

1 participant