Mend machines status
Remove lower() function to prevent an exception of
'int' object has no attribute 'lower'.
Change-Id: Icbf00954f0ebdd2fe8647edcf0cea0be728a77d4
diff --git a/README.rst b/README.rst
index 315534d..d09b6fd 100644
--- a/README.rst
+++ b/README.rst
@@ -250,7 +250,7 @@
- name: maas.wait_for_machine_status
- kwargs:
timeout: 1200 # in seconds
- req_status: "deployed"
+ req_status: "Deployed"
ignore_machines:
- kvm01 # in case it's broken or whatever
- require:
diff --git a/_modules/maas.py b/_modules/maas.py
index c5029a7..cbe223f 100644
--- a/_modules/maas.py
+++ b/_modules/maas.py
@@ -672,7 +672,7 @@
for machine in json_result:
if objects_name and machine['hostname'] not in objects_name:
continue
- status = STATUS_NAME_DICT[machine['status'].lower()]
+ status = STATUS_NAME_DICT[machine['status']]
summary[status] += 1
res.append(
{'hostname': machine['hostname'],
@@ -724,8 +724,10 @@
for m in to_discover:
for discovered in MachinesStatus.execute()['machines']:
if m == discovered['hostname'] and \
- discovered['status'] == req_status.lower():
- if m in total: total.remove(m)
+ discovered['status'].lower() == req_status.lower():
+ if m in total:
+ total.remove(m)
+
if len(total) <= 0:
LOG.debug(
"Machines:{} are:{}".format(to_discover, req_status))