dimgal1 opened a new issue, #1717:
URL: https://github.com/apache/libcloud/issues/1717

   ## Summary
   
   The libcloud driver does not work with the development installation of 
Openstack.
   
   Instruction to install the dev installation are found 
[here](https://docs.openstack.org/devstack/latest/)
   
   ## Detailed Information
   
   Initiating the driver with:
   
   ```python
   from libcloud.compute.types import Provider
   from libcloud.compute.providers import get_driver
   
   Openstack = get_driver(Provider.OPENSTACK)
   
   driver = Openstack("admin", "Password", api_version="2.2", 
ex_force_auth_url="http://<IP>/identity", ex_domain_name="Default", 
ex_tenant_name="admin")
   ```
   
   Then running any command produces the following:
   
   ```python
   driver.list_nodes()                                                          
                                                                                
                                                                                
                            
   ---------------------------------------------------------------------------
   BaseHTTPError                             Traceback (most recent call last)
   <ipython-input-14-dc49087bfcd6> in <module>
   ----> 1 driver.list_nodes()
   
   ~/mist/mist-ee/api/libcloud/libcloud/compute/drivers/openstack.py in 
list_nodes(self, ex_all_tenants)
      3342             params = {"all_tenants": 1}
      3343         return self._to_nodes(
   -> 3344             self._paginated_request(
      3345                 "/servers/detail", "servers", self.connection, 
params=params
      3346             )
   
   ~/mist/mist-ee/api/libcloud/libcloud/compute/drivers/openstack.py in 
_paginated_request(url, obj, connection, params)
       223         loop_count = 0
       224         while True:
   --> 225             data = connection.request(url, params=params)
       226             values = data.object.get(obj, list())
       227             objects.extend(values)
   
   ~/mist/mist-ee/api/libcloud/libcloud/common/openstack.py in request(self, 
action, params, data, headers, method, raw)
       253             headers = {"Content-Type": default_content_type}
       254 
   --> 255         return super(OpenStackBaseConnection, self).request(
       256             action=action,
       257             params=params,
   
   ~/mist/mist-ee/api/libcloud/libcloud/common/base.py in request(self, action, 
params, data, headers, method, raw, stream, json, enforce_unicode_response)
       587         )
       588 
   --> 589         action = self.morph_action_hook(action)
       590         self.action = action
       591         self.method = method
   
   ~/mist/mist-ee/api/libcloud/libcloud/common/openstack.py in 
morph_action_hook(self, action)
       327 
       328     def morph_action_hook(self, action):
   --> 329         self._populate_hosts_and_request_paths()
       330         return super(OpenStackBaseConnection, 
self).morph_action_hook(action)
       331 
   
   ~/mist/mist-ee/api/libcloud/libcloud/common/openstack.py in 
_populate_hosts_and_request_paths(self)
       361                 kwargs = {}
       362 
   --> 363             osa = osa.authenticate(**kwargs)  # may throw 
InvalidCreds
       364 
       365             self.auth_token = osa.auth_token
   
   ~/mist/mist-ee/api/libcloud/libcloud/common/openstack_identity.py in 
authenticate(self, force)
      1120 
      1121         data = json.dumps(data)
   -> 1122         response = self.request(
      1123             "/v3/auth/tokens",
      1124             data=data,
   
   ~/mist/mist-ee/api/libcloud/libcloud/common/base.py in request(self, action, 
params, data, headers, method, raw, stream, json, enforce_unicode_response)
       705 
       706         try:
   --> 707             response = responseCls(**kwargs)
       708         finally:
       709             # Always reset the context after the request has 
completed
   
   ~/mist/mist-ee/api/libcloud/libcloud/common/base.py in __init__(self, 
response, connection)
       155 
       156         if not self.success():
   --> 157             raise exception_from_message(
       158                 code=self.status, message=self.parse_error(), 
headers=self.headers
       159             )
   
   BaseHTTPError: <!doctype html>
   <html lang=en>
   <title>405 Method Not Allowed</title>
   <h1>Method Not Allowed</h1>
   <p>The method is not allowed for the requested URL.</p>
   ```
   
   To my understanding the 
[morph_action_hook](https://github.com/apache/libcloud/blob/trunk/libcloud/common/openstack_identity.py#L771
 ) of the `OpenStackIdentityConnection` does not take into account the given 
action when the Auth url contains a path.
   
   For example in the scenario above the Auth url is `http://<IP>/identity`, 
when the driver tries to  
[authenticate](https://github.com/apache/libcloud/blob/trunk/libcloud/common/openstack_identity.py#L1258)
 the POST request path becomes `/identity`  instead of the correct one 
`/identity/v3/auth/tokens` .
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@libcloud.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to