fix(): check attribute token exists in BaseEC2NodeDriver Closes #820
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/c1ba3bb6 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c1ba3bb6 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c1ba3bb6 Branch: refs/heads/trunk Commit: c1ba3bb6aebed0af4a5fc4b363021d3b1b872535 Parents: 1ac00c7 Author: Alejandro González <[email protected]> Authored: Thu Jun 30 08:43:28 2016 +0200 Committer: Tomaz Muraus <[email protected]> Committed: Sat Jul 2 11:42:40 2016 +0200 ---------------------------------------------------------------------- libcloud/compute/drivers/ec2.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/c1ba3bb6/libcloud/compute/drivers/ec2.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py index 5cfe193..0724c87 100644 --- a/libcloud/compute/drivers/ec2.py +++ b/libcloud/compute/drivers/ec2.py @@ -5435,12 +5435,13 @@ class BaseEC2NodeDriver(NodeDriver): def _ex_connection_class_kwargs(self): kwargs = super(BaseEC2NodeDriver, self)._ex_connection_class_kwargs() - if self.token is None: - kwargs['signature_version'] = self.signature_version - else: + if hasattr(self, 'token') and self.token is not None: kwargs['token'] = self.token # Force signature_version 4 for tokens or auth breaks kwargs['signature_version'] = '4' + else: + kwargs['signature_version'] = self.signature_version + return kwargs def _to_nodes(self, object, xpath):
