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/10 03:03:42 UTC

[07/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/8800dd16
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8800dd16
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8800dd16

Branch: refs/heads/trunk
Commit: 8800dd16154a426e08d69c6898139da2baaf625c
Parents: f964f76
Author: Jie Ren <sn...@126.com>
Authored: Fri Feb 24 11:19:04 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 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/8800dd16/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/8800dd16/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index e11dee1..3b116bd 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)