You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/04/21 05:45:15 UTC
[04/14] libcloud git commit: Modify for CI test
Modify for CI test
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c6b93653
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c6b93653
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c6b93653
Branch: refs/heads/trunk
Commit: c6b93653de9b7a6a4052ae5ae07eaaaee7748163
Parents: 8d40de2
Author: Jie Ren <sn...@126.com>
Authored: Fri Feb 24 11:19:04 2017 +0800
Committer: Jie Ren <sn...@126.com>
Committed: Fri Feb 24 11:19:04 2017 +0800
----------------------------------------------------------------------
libcloud/compute/drivers/ecs.py | 26 +++++++++-----------------
libcloud/test/compute/test_ecs.py | 4 ++--
2 files changed, 11 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c6b93653/libcloud/compute/drivers/ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecs.py b/libcloud/compute/drivers/ecs.py
index 3f12bfd..60ea195 100644
--- a/libcloud/compute/drivers/ecs.py
+++ b/libcloud/compute/drivers/ecs.py
@@ -889,18 +889,13 @@ class ECSDriver(NodeDriver):
if group_id is None:
raise AttributeError('group_id is required')
- nodes = self.list_nodes(ex_node_ids=[node.id])
- if len(nodes) != 1 and node.id != nodes[0].id:
- raise LibcloudError('could not find the node with id %s.'
- % node.id)
- current = nodes[0]
- if (current.state != NodeState.RUNNING) and \
- (current.state != NodeState.STOPPED):
+ if (node.state != NodeState.RUNNING) and \
+ (node.state != NodeState.STOPPED):
raise LibcloudError('The node state with id % s need\
be running or stopped .' % node.id)
params = {'Action': 'JoinSecurityGroup',
- 'InstanceId': current.id,
+ 'InstanceId': node.id,
'SecurityGroupId': group_id}
resp = self.connection.request(self.path, params)
return resp.success()
@@ -919,15 +914,12 @@ class ECSDriver(NodeDriver):
:return: leave operation result.
:rtype: ``bool``
"""
-
- nodes = self.list_nodes(ex_node_ids=[node.id])
- if len(nodes) != 1 and node.id != nodes[0].id:
- raise LibcloudError('could not find the node with id %s.'
- % node.id)
- current = nodes[0]
- if (current.state != NodeState.RUNNING) and \
- (current.state != NodeState.STOPPED):
- raise LibcloudError('The node state with id %s need \
+ if group_id is None:
+ raise AttributeError('group_id is required')
+
+ if (node.state != NodeState.RUNNING) and \
+ (node.state != NodeState.STOPPED):
+ raise LibcloudError('The node state with id % s need\
be running or stopped .' % node.id)
params = {'Action': 'LeaveSecurityGroup',
http://git-wip-us.apache.org/repos/asf/libcloud/blob/c6b93653/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index 6869587..c48388e 100644
--- a/libcloud/test/compute/test_ecs.py
+++ b/libcloud/test/compute/test_ecs.py
@@ -529,12 +529,12 @@ class ECSDriverTestCase(LibcloudTestCase):
self.assertEqual('2015-06-26T08:35:30Z', sg.creation_time)
def test_ex_join_security_group(self):
- ex_security_group_id_value='F876FF7BA984'
+ ex_security_group_id_value='sg-28ou0f3xa'
result = self.driver.ex_join_security_group(self.fake_node, group_id=ex_security_group_id_value)
self.assertTrue(result)
def test_ex_leave_security_group(self):
- ex_security_group_id_value='F876FF7BA984'
+ ex_security_group_id_value='sg-28ou0f3xa'
result = self.driver.ex_leave_security_group(self.fake_node, group_id=ex_security_group_id_value)
self.assertTrue(result)