Repository: apache/libcloud

Issue:
Error with proxy_url in OpenStack auth
## Summary

An error appears when using some OpenStack auth classes where this new ``proxy_url`` parameter has not been added.

Error introduced in commit: c20cf0180dbd30fb4010aba259746808576f9aa8 from PR ##1324.

## Detailed Information

I get the error when trying to use the OpenStackIdentity_3_0_Connection_OIDC_access_token class. But it will appear using any other auth classes where the ``proxy_url`` parameter has not been added.

The error shown is:
```python
  File "/libcloud/compute/drivers/openstack.py", line 417, in ex_get_node_details
    resp = self.connection.request(uri, method='GET')
  File "/libcloud/common/openstack.py", line 225, in request
    raw=raw)
  File "/libcloud/common/base.py", line 538, in request
    action = self.morph_action_hook(action)
  File "/libcloud/common/openstack.py", line 292, in morph_action_hook
    self._populate_hosts_and_request_paths()
  File "/libcloud/common/openstack.py", line 305, in _populate_hosts_and_request_paths
    osa = self.get_auth_class()
  File "/libcloud/common/openstack.py", line 206, in get_auth_class
    parent_conn=self)
TypeError: __init__() got an unexpected keyword argument 'proxy_url'

```


Error with proxy_url in OpenStack auth
## Summary

An error appears when using some OpenStack auth classes where this new ``proxy_url`` parameter has not been added.

Error introduced in commit: c20cf0180dbd30fb4010aba259746808576f9aa8 from PR ##1324.

## Detailed Information

I get the error when trying to use the OpenStackIdentity_3_0_Connection_OIDC_access_token class. But it will appear using any other auth classes where the ``proxy_url`` parameter has not been added.

The error shown is:
```python
  File "/libcloud/compute/drivers/openstack.py", line 417, in ex_get_node_details
    resp = self.connection.request(uri, method='GET')
  File "/libcloud/common/openstack.py", line 225, in request
    raw=raw)
  File "/libcloud/common/base.py", line 538, in request
    action = self.morph_action_hook(action)
  File "/libcloud/common/openstack.py", line 292, in morph_action_hook
    self._populate_hosts_and_request_paths()
  File "/libcloud/common/openstack.py", line 305, in _populate_hosts_and_request_paths
    osa = self.get_auth_class()
  File "/libcloud/common/openstack.py", line 206, in get_auth_class
    parent_conn=self)
TypeError: __init__() got an unexpected keyword argument 'proxy_url'

```


Error with proxy_url in OpenStack auth
## Summary

An error appears when using some OpenStack auth classes where this new ``proxy_url`` parameter has not been added.

Error introduced in commit: c20cf0180dbd30fb4010aba259746808576f9aa8 from PR ##1324.

## Detailed Information

I get the error when trying to use the OpenStackIdentity_3_0_Connection_OIDC_access_token class. But it will appear using any other auth classes where the ``proxy_url`` parameter has not been added.

The error shown is:
```python
  File "/libcloud/compute/drivers/openstack.py", line 417, in ex_get_node_details
    resp = self.connection.request(uri, method='GET')
  File "/libcloud/common/openstack.py", line 225, in request
    raw=raw)
  File "/libcloud/common/base.py", line 538, in request
    action = self.morph_action_hook(action)
  File "/libcloud/common/openstack.py", line 292, in morph_action_hook
    self._populate_hosts_and_request_paths()
  File "/libcloud/common/openstack.py", line 305, in _populate_hosts_and_request_paths
    osa = self.get_auth_class()
  File "/libcloud/common/openstack.py", line 206, in get_auth_class
    parent_conn=self)
TypeError: __init__() got an unexpected keyword argument 'proxy_url'

```




Discussion:

Resolving patch:
diff --git a/libcloud/common/openstack_identity.py b/libcloud/common/openstack_identity.py
--- a/libcloud/common/openstack_identity.py
+++ b/libcloud/common/openstack_identity.py
@@ -933,7 +933,7 @@ class OpenStackIdentity_3_0_Connection(OpenStackIdentityConnection):
     def __init__(self, auth_url, user_id, key, tenant_name=None,
                  domain_name='Default',
                  token_scope=OpenStackIdentityTokenScope.PROJECT,
-                 timeout=None, parent_conn=None):
+                 timeout=None, proxy_url=None, parent_conn=None):
         """
         :param tenant_name: Name of the project this user belongs to. Note:
                             When token_scope is set to project, this argument
@@ -957,6 +957,7 @@ def __init__(self, auth_url, user_id, key, tenant_name=None,
                              domain_name=domain_name,
                              token_scope=token_scope,
                              timeout=timeout,
+                             proxy_url=proxy_url,
                              parent_conn=parent_conn)
 
         if self.token_scope not in self.VALID_TOKEN_SCOPES:
@@ -1585,9 +1586,10 @@ class OpenStackIdentity_2_0_Connection_VOMS(OpenStackIdentityConnection,
     def __init__(self, auth_url, user_id, key, tenant_name=None,
                  domain_name='Default',
                  token_scope=OpenStackIdentityTokenScope.PROJECT,
-                 timeout=None, parent_conn=None):
+                 timeout=None, proxy_url=None, parent_conn=None):
         CertificateConnection.__init__(self, cert_file=key,
                                        url=auth_url,
+                                       proxy_url=proxy_url,
                                        timeout=timeout)
 
         self.parent_conn = parent_conn
@@ -1604,6 +1606,7 @@ def __init__(self, auth_url, user_id, key, tenant_name=None,
         self.domain_name = domain_name
         self.token_scope = token_scope
         self.timeout = timeout
+        self.proxy_url = proxy_url
 
         self.urls = {}
         self.auth_token = None


Test patch:
diff --git a/libcloud/test/common/test_openstack_identity.py b/libcloud/test/common/test_openstack_identity.py
--- a/libcloud/test/common/test_openstack_identity.py
+++ b/libcloud/test/common/test_openstack_identity.py
@@ -232,8 +232,11 @@ def setUp(self):
         self.auth_instance = OpenStackIdentity_2_0_Connection(auth_url='http://none',
                                                               user_id='test',
                                                               key='test',
-                                                              tenant_name='test')
+                                                              tenant_name='test',
+                                                              proxy_url='http://proxy:8080',
+                                                              timeout=10)
         self.auth_instance.auth_token = 'mock'
+        self.assertEqual(self.auth_instance.proxy_url, 'http://proxy:8080')
 
     def test_list_projects(self):
         result = self.auth_instance.list_projects()
@@ -253,8 +256,11 @@ def setUp(self):
         self.auth_instance = OpenStackIdentity_3_0_Connection(auth_url='http://none',
                                                               user_id='test',
                                                               key='test',
-                                                              tenant_name='test')
+                                                              tenant_name='test',
+                                                              proxy_url='http://proxy:8080',
+                                                              timeout=10)
         self.auth_instance.auth_token = 'mock'
+        self.assertEqual(self.auth_instance.proxy_url, 'http://proxy:8080')
 
     def test_token_scope_argument(self):
         # Invalid token_scope value
@@ -306,8 +312,11 @@ def test_authenticate(self):
                                                 key='test_key',
                                                 token_scope='project',
                                                 tenant_name="test_tenant",
-                                                domain_name='test_domain')
+                                                domain_name='test_domain',
+                                                proxy_url='http://proxy:8080',
+                                                timeout=10)
         auth.authenticate()
+        self.assertEqual(auth.proxy_url, 'http://proxy:8080')
 
     def test_list_supported_versions(self):
         OpenStackIdentity_3_0_MockHttp.type = 'v3'
@@ -454,7 +463,9 @@ def setUp(self):
         self.auth_instance = OpenStackIdentity_3_0_Connection_OIDC_access_token(auth_url='http://none',
                                                                                 user_id='idp',
                                                                                 key='token',
-                                                                                tenant_name='oidc')
+                                                                                tenant_name='oidc',
+                                                                                proxy_url='http://proxy:8080',
+                                                                                timeout=10)
         self.auth_instance.auth_token = 'mock'
 
     def test_authenticate(self):
@@ -462,7 +473,9 @@ def test_authenticate(self):
                                                                   user_id='idp',
                                                                   key='token',
                                                                   token_scope='project',
-                                                                  tenant_name="oidc")
+                                                                  tenant_name="oidc",
+                                                                  proxy_url='http://proxy:8080',
+                                                                  timeout=10)
         auth.authenticate()
 
 
@@ -842,5 +855,6 @@ def _v2_0_tenants(self, method, url, body, headers):
             return (httplib.OK, body, self.json_content_headers, httplib.responses[httplib.OK])
         raise NotImplementedError()
 
+
 if __name__ == '__main__':
     sys.exit(unittest.main())