Repository: libcloud Updated Branches: refs/heads/trunk 01dca19ad -> f68a71920
Proxy_url & connection object fixes The proxy_url was not being passed to the base Connection class by the base NodeDriver. Within the vCouldNodeDriver a new connection class we being created with no custom variables rather than re-using the existing connection class. Closes #578 Signed-off-by: MrBasset <[email protected]> Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3fa2e1b4 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3fa2e1b4 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3fa2e1b4 Branch: refs/heads/trunk Commit: 3fa2e1b4f70ed472ba39c74322915412f2d44f36 Parents: 01dca19 Author: MrBasset <[email protected]> Authored: Fri Sep 11 14:22:58 2015 -0400 Committer: Tomaz Muraus <[email protected]> Committed: Fri Sep 25 12:57:45 2015 +0200 ---------------------------------------------------------------------- libcloud/common/base.py | 3 ++- libcloud/compute/drivers/vcloud.py | 21 +++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/3fa2e1b4/libcloud/common/base.py ---------------------------------------------------------------------- diff --git a/libcloud/common/base.py b/libcloud/common/base.py index d4cbbae..929a43f 100644 --- a/libcloud/common/base.py +++ b/libcloud/common/base.py @@ -1099,7 +1099,8 @@ class BaseDriver(object): conn_kwargs = self._ex_connection_class_kwargs() conn_kwargs.update({'timeout': kwargs.pop('timeout', None), 'retry_delay': kwargs.pop('retry_delay', None), - 'backoff': kwargs.pop('backoff', None)}) + 'backoff': kwargs.pop('backoff', None), + 'proxy_url': kwargs.pop('proxy_url', None)}) self.connection = self.connectionCls(*args, **conn_kwargs) self.connection.driver = self http://git-wip-us.apache.org/repos/asf/libcloud/blob/3fa2e1b4/libcloud/compute/drivers/vcloud.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/vcloud.py b/libcloud/compute/drivers/vcloud.py index 0ce10b3..c956f13 100644 --- a/libcloud/compute/drivers/vcloud.py +++ b/libcloud/compute/drivers/vcloud.py @@ -335,12 +335,10 @@ class VCloudConnection(ConnectionUserAndKey): def _get_auth_token(self): if not self.token: - conn = self.conn_classes[self.secure](self.host, - self.port) - conn.request(method='POST', url='/api/v0.8/login', - headers=self._get_auth_headers()) + self.connection.request(method='POST', url='/api/v0.8/login', + headers=self._get_auth_headers()) - resp = conn.getresponse() + resp = self.connection.getresponse() headers = dict(resp.getheaders()) body = ET.XML(resp.read()) @@ -829,12 +827,10 @@ class VCloud_1_5_Connection(VCloudConnection): def _get_auth_token(self): if not self.token: # Log In - conn = self.conn_classes[self.secure](self.host, - self.port) - conn.request(method='POST', url='/api/sessions', - headers=self._get_auth_headers()) + self.connection.request(method='POST', url='/api/sessions', + headers=self._get_auth_headers()) - resp = conn.getresponse() + resp = self.connection.getresponse() headers = dict(resp.getheaders()) # Set authorization token @@ -852,8 +848,9 @@ class VCloud_1_5_Connection(VCloudConnection): 'application/vnd.vmware.vcloud.orgList+xml')).get('href') ) - conn.request(method='GET', url=org_list_url, - headers=self.add_default_headers({})) + self.connection.set_http_proxy ( self.proxy_url ) + self.connection.request(method='GET', url=org_list_url, + headers=self.add_default_headers({})) body = ET.XML(conn.getresponse().read()) self.driver.org = get_url_path( next((org for org in body.findall(fixxpath(body, 'Org'))
