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:36 UTC

[01/14] libcloud git commit: Add join/leave security group methods for aliyun ECS

Repository: libcloud
Updated Branches:
  refs/heads/trunk 14cb428e4 -> 222f0cce5


Add join/leave security group methods for aliyun ECS


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/54c68910
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/54c68910
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/54c68910

Branch: refs/heads/trunk
Commit: 54c68910730c8291c539b63b4e72cc81992b3b40
Parents: 14cb428
Author: Jie Ren <sn...@126.com>
Authored: Mon Feb 20 16:42:54 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:21 2017 +1000

----------------------------------------------------------------------
 libcloud/compute/drivers/ecs.py                 | 64 +++++++++++++++++++-
 .../fixtures/ecs/join_security_group_by_id.xml  |  4 ++
 .../fixtures/ecs/leave_security_group_by_id.xml |  4 ++
 libcloud/test/compute/test_ecs.py               |  8 +++
 4 files changed, 78 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/54c68910/libcloud/compute/drivers/ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecs.py b/libcloud/compute/drivers/ecs.py
index 03105ca..744b5ce 100644
--- a/libcloud/compute/drivers/ecs.py
+++ b/libcloud/compute/drivers/ecs.py
@@ -872,6 +872,67 @@ class ECSDriver(NodeDriver):
                                namespace=self.namespace)
         return [self._to_security_group_attribute(el) for el in sga_elements]
 
+    def ex_join_security_group(self, node, group_id=None):
+        """
+        Join a node into security group.
+
+        :param node: The node to join security group
+        :type node: :class:`Node`
+
+        :keyword group_id: security group id.
+        :type ex_filters: ``str``
+
+
+        :return: join operation result.
+        :rtype: ``bool``
+        """
+        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:
+            raise LibcloudError('The node state with id %s need be running or stopped .' % node.id)
+
+        params = {'Action': 'JoinSecurityGroup',
+                  'InstanceId': current.id,
+                  'SecurityGroupId': group_id}
+        resp = self.connection.request(self.path, params)
+        return resp.success()
+
+    def ex_leave_security_group(self, node, group_id=None):
+        """
+        Leave a node from security group.
+
+        :param node: The node to leave security group
+        :type node: :class:`Node`
+
+        :keyword group_id: security group id.
+        :type ex_filters: ``str``
+
+
+        :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 with id %s could not join security group, node need be running or stopped .'
+                                % node.id)
+
+        params = {'Action': 'LeaveSecurityGroup',
+                  'InstanceId': node.id,
+                  'SecurityGroupId': group_id}
+        resp = self.connection.request(self.path, params)
+        return resp.success()
+
     def ex_list_zones(self, region_id=None):
         """
         List availability zones in the given region or the current region.
@@ -891,8 +952,7 @@ class ECSDriver(NodeDriver):
         zone_elements = findall(resp_body, 'Zones/Zone',
                                 namespace=self.namespace)
         zones = [self._to_zone(el) for el in zone_elements]
-        return zones
-
+        return zones    
     ##
     # Volume and snapshot management methods
     ##

http://git-wip-us.apache.org/repos/asf/libcloud/blob/54c68910/libcloud/test/compute/fixtures/ecs/join_security_group_by_id.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/ecs/join_security_group_by_id.xml b/libcloud/test/compute/fixtures/ecs/join_security_group_by_id.xml
new file mode 100644
index 0000000..ad8f493
--- /dev/null
+++ b/libcloud/test/compute/fixtures/ecs/join_security_group_by_id.xml
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<JoinSecurityGroupResponse>
+	<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
+</JoinSecurityGroupResponse>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/54c68910/libcloud/test/compute/fixtures/ecs/leave_security_group_by_id.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/ecs/leave_security_group_by_id.xml b/libcloud/test/compute/fixtures/ecs/leave_security_group_by_id.xml
new file mode 100644
index 0000000..c6c00f9
--- /dev/null
+++ b/libcloud/test/compute/fixtures/ecs/leave_security_group_by_id.xml
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<LeaveSecurityGroupResponse>
+	<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
+</LeaveSecurityGroupResponse>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/54c68910/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index 1fb9798..e6a0d5a 100644
--- a/libcloud/test/compute/test_ecs.py
+++ b/libcloud/test/compute/test_ecs.py
@@ -528,6 +528,14 @@ class ECSDriverTestCase(LibcloudTestCase):
         self.assertEqual('', sg.vpc_id)
         self.assertEqual('2015-06-26T08:35:30Z', sg.creation_time)
 
+    def test_ex_join_security_group(self):
+        result = self.driver.ex_join_security_group(self.fake_node, ex_security_group_id='F876FF7BA984')
+        self.assertTrue(result)
+
+    def test_ex_leave_security_group(self):
+        result = self.driver.ex_leave_security_group(self.fake_node, ex_security_group_id='F876FF7BA984')
+        self.assertTrue(result)
+
     def test_ex_list_security_groups_with_ex_filters(self):
         ECSMockHttp.type = 'list_sgs_filters'
         self.vpc_id = 'vpc1'


[02/14] libcloud git commit: Update ecs.py

Posted by an...@apache.org.
Update ecs.py

fix for code review


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8dd45647
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8dd45647
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8dd45647

Branch: refs/heads/trunk
Commit: 8dd45647f0f1d267d5ff582c1069c950faf86ffa
Parents: 553c5f9
Author: Jaren <sn...@126.com>
Authored: Thu Apr 6 12:59:21 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 libcloud/compute/drivers/ecs.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/8dd45647/libcloud/compute/drivers/ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecs.py b/libcloud/compute/drivers/ecs.py
index 06b6f7d..e92d467 100644
--- a/libcloud/compute/drivers/ecs.py
+++ b/libcloud/compute/drivers/ecs.py
@@ -889,8 +889,8 @@ class ECSDriver(NodeDriver):
         if group_id is None:
             raise AttributeError('group_id is required')
 
-        if (node.state != NodeState.RUNNING) and \
-           (node.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)
 
@@ -917,8 +917,8 @@ class ECSDriver(NodeDriver):
         if group_id is None:
             raise AttributeError('group_id is required')
 
-        if (node.state != NodeState.RUNNING) and \
-           (node.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)
 


[07/14] libcloud git commit: Modify for CI test

Posted by an...@apache.org.
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)
 


[06/14] libcloud git commit: Modify for CI test

Posted by an...@apache.org.
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/f964f767
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f964f767
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f964f767

Branch: refs/heads/trunk
Commit: f964f7674d42bc6c47e0b29de4357d50fd737adc
Parents: a3f78db
Author: Jie Ren <sn...@126.com>
Authored: Thu Feb 23 09:00:58 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 libcloud/test/compute/test_ecs.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f964f767/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index 66658a0..e11dee1 100644
--- a/libcloud/test/compute/test_ecs.py
+++ b/libcloud/test/compute/test_ecs.py
@@ -530,12 +530,12 @@ class ECSDriverTestCase(LibcloudTestCase):
 
     def test_ex_join_security_group(self):
         ex_security_group_id_value='F876FF7BA984'
-        result = self.driver.ex_join_security_group(self.fake_node, ex_security_group_id=ex_security_group_id_value)
+        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'
-        result = self.driver.ex_leave_security_group(self.fake_node, ex_security_group_id=ex_security_group_id_value)
+        result = self.driver.ex_leave_security_group(self.fake_node, group_id=ex_security_group_id_value)
         self.assertTrue(result)
 
     def test_ex_list_security_groups_with_ex_filters(self):


[12/14] libcloud git commit: Modify for CI

Posted by an...@apache.org.
Modify for CI


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6b940385
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6b940385
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6b940385

Branch: refs/heads/trunk
Commit: 6b940385fce64c067f287007319538b7edfdbbeb
Parents: 3f3f231
Author: Jie Ren <sn...@126.com>
Authored: Mon Feb 27 10:58:26 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 libcloud/compute/drivers/ecs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/6b940385/libcloud/compute/drivers/ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecs.py b/libcloud/compute/drivers/ecs.py
index 60ea195..14134e2 100644
--- a/libcloud/compute/drivers/ecs.py
+++ b/libcloud/compute/drivers/ecs.py
@@ -916,7 +916,7 @@ class ECSDriver(NodeDriver):
         """
         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\


[13/14] libcloud git commit: Modify for CI

Posted by an...@apache.org.
Modify for CI


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f30db78b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f30db78b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f30db78b

Branch: refs/heads/trunk
Commit: f30db78b6eb6b4cc03ac81c34e95bc4216ef156d
Parents: eee5436
Author: Jie Ren <sn...@126.com>
Authored: Mon Feb 27 15:33:27 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 libcloud/test/compute/test_ecs.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f30db78b/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index 498f917..dc3a615 100644
--- a/libcloud/test/compute/test_ecs.py
+++ b/libcloud/test/compute/test_ecs.py
@@ -530,16 +530,14 @@ class ECSDriverTestCase(LibcloudTestCase):
 
     def test_ex_join_security_group(self):
         ex_security_group_id_value = 'sg-28ou0f3xa'
-        result = self.driver.ex_join_security_group(
-              self.fake_node,
-              group_id=ex_security_group_id_value)
+        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 = 'sg-28ou0f3xa'
-        result = self.driver.ex_leave_security_group(
-               self.fake_node,
-               group_id=ex_security_group_id_value)
+        result = self.driver.ex_leave_security_group(self.fake_node,
+                                                     group_id=ex_security_group_id_value)
         self.assertTrue(result)
 
     def test_ex_list_security_groups_with_ex_filters(self):


[03/14] libcloud git commit: Update ecs.py

Posted by an...@apache.org.
Update ecs.py

fix doc


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/553c5f93
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/553c5f93
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/553c5f93

Branch: refs/heads/trunk
Commit: 553c5f93f0fb0d86da22afa26b2956e6b42d609b
Parents: ad8b812
Author: Jaren <sn...@126.com>
Authored: Thu Apr 6 12:50:03 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 libcloud/compute/drivers/ecs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/553c5f93/libcloud/compute/drivers/ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecs.py b/libcloud/compute/drivers/ecs.py
index 26ee69a..06b6f7d 100644
--- a/libcloud/compute/drivers/ecs.py
+++ b/libcloud/compute/drivers/ecs.py
@@ -880,7 +880,7 @@ class ECSDriver(NodeDriver):
         :type node: :class:`Node`
 
         :param group_id: security group id.
-        :type ex_filters: ``str``
+        :type group_id: ``str``
 
 
         :return: join operation result.


[04/14] libcloud git commit: Modify for CI

Posted by an...@apache.org.
Modify for CI


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/436e4132
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/436e4132
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/436e4132

Branch: refs/heads/trunk
Commit: 436e4132bc580cf6cf02bb3f27c8da3b8cb82cc1
Parents: 6b94038
Author: Jie Ren <sn...@126.com>
Authored: Mon Feb 27 12:42:47 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 libcloud/test/compute/test_ecs.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/436e4132/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index 22ef5ac..6a97643 100644
--- a/libcloud/test/compute/test_ecs.py
+++ b/libcloud/test/compute/test_ecs.py
@@ -531,17 +531,15 @@ class ECSDriverTestCase(LibcloudTestCase):
     def test_ex_join_security_group(self):
         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.fake_node,
+             group_id=ex_security_group_id_value)
         self.assertTrue(result)
 
     def test_ex_leave_security_group(self):
         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.fake_node,
+             group_id=ex_security_group_id_value)
         self.assertTrue(result)
 
     def test_ex_list_security_groups_with_ex_filters(self):


[10/14] libcloud git commit: Modify for CI

Posted by an...@apache.org.
Modify for CI


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/eee54361
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/eee54361
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/eee54361

Branch: refs/heads/trunk
Commit: eee543618338395abf19a88c57070bb30caa0094
Parents: 436e413
Author: Jie Ren <sn...@126.com>
Authored: Mon Feb 27 13:43:11 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 libcloud/test/compute/test_ecs.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/eee54361/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index 6a97643..498f917 100644
--- a/libcloud/test/compute/test_ecs.py
+++ b/libcloud/test/compute/test_ecs.py
@@ -531,15 +531,15 @@ class ECSDriverTestCase(LibcloudTestCase):
     def test_ex_join_security_group(self):
         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.fake_node,
+              group_id=ex_security_group_id_value)
         self.assertTrue(result)
 
     def test_ex_leave_security_group(self):
         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.fake_node,
+               group_id=ex_security_group_id_value)
         self.assertTrue(result)
 
     def test_ex_list_security_groups_with_ex_filters(self):


[08/14] libcloud git commit: Modify for test

Posted by an...@apache.org.
Modify for test


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/739b4350
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/739b4350
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/739b4350

Branch: refs/heads/trunk
Commit: 739b4350aee128caf0979ff758921154f6ecb0c7
Parents: 8800dd1
Author: Jie Ren <sn...@126.com>
Authored: Mon Feb 27 09:29:07 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 libcloud/test/compute/test_ecs.py | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/739b4350/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index 3b116bd..77d60b5 100644
--- a/libcloud/test/compute/test_ecs.py
+++ b/libcloud/test/compute/test_ecs.py
@@ -912,6 +912,14 @@ class ECSMockHttp(MockHttpTestCase):
         self.assertUrlContainsQueryParams(url, params)
         resp_body = self.fixtures.load('describe_security_groups.xml')
         return (httplib.OK, resp_body, {}, httplib.responses[httplib.OK])
+    
+    def _JoinSecurityGroup(self, method, url, body, headers):
+        body = self.fixtures.load('join_security_group_by_id.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+    
+    def _LeaveSecurityGroup(self, method, url, body, headers):
+        body = self.fixtures.load('leave_security_group_by_id.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _list_sgs_filters_DescribeSecurityGroups(self, method, url, body,
                                                  headers):


[11/14] libcloud git commit: Update ecs.py

Posted by an...@apache.org.
Update ecs.py

fix doc


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ad8b812b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ad8b812b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ad8b812b

Branch: refs/heads/trunk
Commit: ad8b812bcf0968c4f6a329f8919e999db0604833
Parents: f30db78
Author: Jaren <sn...@126.com>
Authored: Thu Apr 6 12:47:51 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 libcloud/compute/drivers/ecs.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/ad8b812b/libcloud/compute/drivers/ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecs.py b/libcloud/compute/drivers/ecs.py
index 14134e2..26ee69a 100644
--- a/libcloud/compute/drivers/ecs.py
+++ b/libcloud/compute/drivers/ecs.py
@@ -851,7 +851,7 @@ class ECSDriver(NodeDriver):
         List security group attributes in the current region.
 
         :keyword group_id: security group id.
-        :type ex_filters: ``str``
+        :type group_id: ``str``
 
         :keyword nic_type: internet|intranet.
         :type nic_type: ``str``
@@ -908,7 +908,7 @@ class ECSDriver(NodeDriver):
         :type node: :class:`Node`
 
         :param group_id: security group id.
-        :type ex_filters: ``str``
+        :type group_id: ``str``
 
 
         :return: leave operation result.


[09/14] libcloud git commit: Modify for test

Posted by an...@apache.org.
Modify for test


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3f3f231d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3f3f231d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3f3f231d

Branch: refs/heads/trunk
Commit: 3f3f231ddf5ee56fce1dc88e943ae21290afc627
Parents: 739b435
Author: Jie Ren <sn...@126.com>
Authored: Mon Feb 27 10:15:05 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 libcloud/test/compute/test_ecs.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/3f3f231d/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index 77d60b5..22ef5ac 100644
--- a/libcloud/test/compute/test_ecs.py
+++ b/libcloud/test/compute/test_ecs.py
@@ -529,13 +529,19 @@ 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='sg-28ou0f3xa'
-        result = self.driver.ex_join_security_group(self.fake_node, group_id=ex_security_group_id_value)
+        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='sg-28ou0f3xa'
-        result = self.driver.ex_leave_security_group(self.fake_node, group_id=ex_security_group_id_value)
+        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)
 
     def test_ex_list_security_groups_with_ex_filters(self):
@@ -912,11 +918,11 @@ class ECSMockHttp(MockHttpTestCase):
         self.assertUrlContainsQueryParams(url, params)
         resp_body = self.fixtures.load('describe_security_groups.xml')
         return (httplib.OK, resp_body, {}, httplib.responses[httplib.OK])
-    
+
     def _JoinSecurityGroup(self, method, url, body, headers):
         body = self.fixtures.load('join_security_group_by_id.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-    
+
     def _LeaveSecurityGroup(self, method, url, body, headers):
         body = self.fixtures.load('leave_security_group_by_id.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])


[14/14] libcloud git commit: Changes for #992

Posted by an...@apache.org.
Changes for #992

Closes #1017


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/222f0cce
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/222f0cce
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/222f0cce

Branch: refs/heads/trunk
Commit: 222f0cce5f6f648d424ac15ea62f18ba07894491
Parents: 8dd4564
Author: Anthony Shaw <an...@apache.org>
Authored: Mon Apr 10 13:03:09 2017 +1000
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:03:09 2017 +1000

----------------------------------------------------------------------
 CHANGES.rst | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/222f0cce/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 176648e..b9a2e7b 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -14,6 +14,10 @@ Common
 Compute
 ~~~~~~~
 
+- Add aliyun ecs instance join leave security group
+  [GITHUB-992]
+  (Jie Ren)
+
 - Add keypair management to OnApp driver
   [GITHUB-1018]
   (Tinu Cleatus)


[05/14] libcloud git commit: Modify for CI test

Posted by an...@apache.org.
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/a3f78dba
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a3f78dba
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a3f78dba

Branch: refs/heads/trunk
Commit: a3f78dbafb4df4ab7566b10ab87211f78a059b89
Parents: 54c6891
Author: Jie Ren <sn...@126.com>
Authored: Wed Feb 22 10:53:29 2017 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Apr 10 13:02:22 2017 +1000

----------------------------------------------------------------------
 libcloud/compute/drivers/ecs.py   | 19 +++++++++++--------
 libcloud/test/compute/test_ecs.py |  6 ++++--
 2 files changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a3f78dba/libcloud/compute/drivers/ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecs.py b/libcloud/compute/drivers/ecs.py
index 744b5ce..3f12bfd 100644
--- a/libcloud/compute/drivers/ecs.py
+++ b/libcloud/compute/drivers/ecs.py
@@ -879,7 +879,7 @@ class ECSDriver(NodeDriver):
         :param node: The node to join security group
         :type node: :class:`Node`
 
-        :keyword group_id: security group id.
+        :param group_id: security group id.
         :type ex_filters: ``str``
 
 
@@ -894,8 +894,10 @@ class ECSDriver(NodeDriver):
             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 be running or stopped .' % node.id)
+        if (current.state != NodeState.RUNNING) and \
+           (current.state != NodeState.STOPPED):
+            raise LibcloudError('The node state with id % s need\
+                                be running or stopped .' % node.id)
 
         params = {'Action': 'JoinSecurityGroup',
                   'InstanceId': current.id,
@@ -910,7 +912,7 @@ class ECSDriver(NodeDriver):
         :param node: The node to leave security group
         :type node: :class:`Node`
 
-        :keyword group_id: security group id.
+        :param group_id: security group id.
         :type ex_filters: ``str``
 
 
@@ -923,9 +925,10 @@ class ECSDriver(NodeDriver):
             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 with id %s could not join security group, node need be running or stopped .'
-                                % node.id)
+        if (current.state != NodeState.RUNNING) and \
+           (current.state != NodeState.STOPPED):
+            raise LibcloudError('The node state with id %s need \
+                                be running or stopped .' % node.id)
 
         params = {'Action': 'LeaveSecurityGroup',
                   'InstanceId': node.id,
@@ -952,7 +955,7 @@ class ECSDriver(NodeDriver):
         zone_elements = findall(resp_body, 'Zones/Zone',
                                 namespace=self.namespace)
         zones = [self._to_zone(el) for el in zone_elements]
-        return zones    
+        return zones
     ##
     # Volume and snapshot management methods
     ##

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a3f78dba/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index e6a0d5a..66658a0 100644
--- a/libcloud/test/compute/test_ecs.py
+++ b/libcloud/test/compute/test_ecs.py
@@ -529,11 +529,13 @@ class ECSDriverTestCase(LibcloudTestCase):
         self.assertEqual('2015-06-26T08:35:30Z', sg.creation_time)
 
     def test_ex_join_security_group(self):
-        result = self.driver.ex_join_security_group(self.fake_node, ex_security_group_id='F876FF7BA984')
+        ex_security_group_id_value='F876FF7BA984'
+        result = self.driver.ex_join_security_group(self.fake_node, ex_security_group_id=ex_security_group_id_value)
         self.assertTrue(result)
 
     def test_ex_leave_security_group(self):
-        result = self.driver.ex_leave_security_group(self.fake_node, ex_security_group_id='F876FF7BA984')
+        ex_security_group_id_value='F876FF7BA984'
+        result = self.driver.ex_leave_security_group(self.fake_node, ex_security_group_id=ex_security_group_id_value)
         self.assertTrue(result)
 
     def test_ex_list_security_groups_with_ex_filters(self):