Added check for deployed machines
When the node is deployed it is in "Deployed" state,
which causes both assign_ips and deploy states to fail while
working out those nodes.
Change-Id: I8793f1ff6d57a32ae52c6ce208fa316d7106bb1c
diff --git a/_modules/maas.py b/_modules/maas.py
index b123776..e545a53 100644
--- a/_modules/maas.py
+++ b/_modules/maas.py
@@ -387,6 +387,7 @@
class AssignMachinesIP(MaasObject):
READY = 4
+ DEPLOYED = 6
def __init__(self):
super(AssignMachinesIP, self).__init__()
@@ -403,6 +404,8 @@
def fill_data(self, name, data, machines):
interface = data['interface']
machine = machines[name]
+ if machine['status'] == self.DEPLOYED:
+ return
if machine['status'] != self.READY:
raise Exception('Not in ready state')
if 'ip' not in interface:
@@ -422,6 +425,7 @@
class DeployMachines(MaasObject):
READY = 4
+ DEPLOYED = 6
def __init__(self):
super(DeployMachines, self).__init__()
@@ -434,6 +438,8 @@
def fill_data(self, name, machine_data, machines):
machine = machines[name]
+ if machine['status'] == self.DEPLOYED:
+ return
if machine['status'] != self.READY:
raise Exception('Not in ready state')
data = {