python icon indicating copy to clipboard operation
python copied to clipboard

Error with api when set configuration assert_hostname as true

Open Azteker opened this issue 1 year ago • 1 comments

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 avatar Jun 29 '24 00:06 Azteker

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Sep 27 '24 01:09 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Oct 27 '24 02:10 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Nov 26 '24 03:11 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Nov 26 '24 03:11 k8s-ci-robot