libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From quent...@apache.org
Subject [3/6] libcloud git commit: Fix provisioningState. Fix lint.
Date Fri, 13 Oct 2017 04:21:50 GMT
Fix provisioningState.  Fix lint.

Signed-off-by: Quentin Pradet <quentinp@apache.org>


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

Branch: refs/heads/trunk
Commit: 6c082c1ac90d273855785e0208ef0ac52a7ab1e2
Parents: 0aed12e
Author: Peter Amstutz <peter.amstutz@curoverse.com>
Authored: Tue Oct 10 16:05:51 2017 -0400
Committer: Quentin Pradet <quentinp@apache.org>
Committed: Fri Oct 13 08:16:03 2017 +0400

----------------------------------------------------------------------
 libcloud/compute/drivers/azure_arm.py | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/6c082c1a/libcloud/compute/drivers/azure_arm.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py
index ac31d90..dc183de 100644
--- a/libcloud/compute/drivers/azure_arm.py
+++ b/libcloud/compute/drivers/azure_arm.py
@@ -360,7 +360,9 @@ class AzureNodeDriver(NodeDriver):
                                  ex_offer, ex_sku, ex_version)
             return i[0] if i else None
 
-    def list_nodes(self, ex_resource_group=None, ex_fetch_nic=True, ex_fetch_power_state=True):
+    def list_nodes(self, ex_resource_group=None,
+                   ex_fetch_nic=True,
+                   ex_fetch_power_state=True):
         """
         List all nodes.
 
@@ -368,8 +370,9 @@ class AzureNodeDriver(NodeDriver):
         :type ex_urn: ``str``
 
         :param ex_fetch_nic: Fetch NIC resources in order to get
-        IP address information for nodes.  If True, requires an extra API call
-        for each NIC of each node.  If False, IP addresses will not be returned.
+        IP address information for nodes.  If True, requires an extra API
+        call for each NIC of each node.  If False, IP addresses will not
+        be returned.
         :type ex_urn: ``bool``
 
         :param ex_fetch_power_state: Fetch node power state.  If True, requires
@@ -391,7 +394,9 @@ class AzureNodeDriver(NodeDriver):
                      % (self.subscription_id)
         r = self.connection.request(action,
                                     params={"api-version": "2015-06-15"})
-        return [self._to_node(n, fetch_nic=ex_fetch_nic, fetch_power_state=ex_fetch_power_state)
+        return [self._to_node(n,
+                              fetch_nic=ex_fetch_nic,
+                              fetch_power_state=ex_fetch_power_state)
                 for n in r.object["value"]]
 
     def create_node(self,
@@ -2019,15 +2024,16 @@ class AzureNodeDriver(NodeDriver):
         if fetch_power_state:
             state = self._fetch_power_state(data)
         else:
-            if data["provisioningState"] == "creating":
+            ps = data["properties"]["provisioningState"]
+            if ps == "creating":
                 state = NodeState.PENDING
-            elif data["provisioningState"] == "deleting":
+            elif ps == "deleting":
                 state = NodeState.TERMINATED
-            elif data["provisioningState"] == "failed":
+            elif ps == "failed":
                 state = NodeState.ERROR
-            elif data["provisioningState"] == "updating":
+            elif ps == "updating":
                 state = NodeState.UPDATING
-            elif data["provisioningState"] == "succeeded":
+            elif ps == "succeeded":
                 state = NodeState.RUNNING
 
         node = Node(data["id"],


Mime
View raw message