You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2019/07/18 09:29:14 UTC
[libcloud] 02/03: Instead of returning False,
throw on unsupported attribute.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 2085972af239fc91bfc3d7e06898038e5b0b6bd6
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Thu Jul 18 11:25:19 2019 +0200
Instead of returning False, throw on unsupported attribute.
---
libcloud/compute/drivers/ec2.py | 2 +-
libcloud/test/compute/test_ec2.py | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index a99c174..5037640 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -2853,7 +2853,7 @@ class BaseEC2NodeDriver(NodeDriver):
elif attribute == 'auto_ipv6':
params['AssignIpv6AddressOnCreation.Value'] = value
else:
- return False
+ raise ValueError('Unsupported attribute: %s' % (attribute))
res = self.connection.request(self.path, params=params).object
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 8f21eb6..9281c60 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -1172,10 +1172,13 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin):
'auto_ipv6',
False)
self.assertTrue(resp)
- resp = self.driver.ex_modify_subnet_attribute(subnet,
- 'invalid',
- True)
- self.assertFalse(resp)
+
+ expected_msg = 'Unsupported attribute: invalid'
+ self.assertRaisesRegexp(ValueError, expected_msg,
+ self.driver.ex_modify_subnet_attribute,
+ subnet,
+ 'invalid',
+ True)
def test_ex_delete_subnet(self):
subnet = self.driver.ex_list_subnets()[0]