Fix retry handlers
* readlines() - invalid method for Exception,
which brakes retry logic in code
Change-Id: I96ac4344cff6d5a0a1a351f983bed31f071bce0a
Prod-related: PROD-28636 (PROD:28636)
diff --git a/_modules/maasng.py b/_modules/maasng.py
index 72f22b7..c2676c1 100644
--- a/_modules/maasng.py
+++ b/_modules/maasng.py
@@ -1326,10 +1326,7 @@
result["changes"] = "Fabric {0} updated".format(json_res["name"])
except Exception as inst:
LOG.debug("create_fabric data:{}".format(data))
- try:
- m = inst.readlines()
- except:
- m = inst.message
+ m = inst.message
LOG.error("Message:{0}".format(m))
result['result'] = False
result['comment'] = 'Error creating fabric: {0}'.format(name)
@@ -1376,7 +1373,7 @@
json_res = json.loads(
maas.get(u'api/2.0/fabrics/{0}/vlans/'.format(fabric_id)).read())
except Exception as inst:
- m = inst.readlines()
+ m = inst.message
LOG.error("Message:{0}".format(m))
LOG.debug(json_res)
for item in json_res:
@@ -1455,10 +1452,7 @@
u'api/2.0/fabrics/{0}/vlans/'.format(fabric_id), None, **data).read())
except Exception as inst:
LOG.debug("create_vlan_in_fabric data:{}".format(data))
- try:
- m = inst.readlines()
- except:
- m = inst.message
+ m = inst.message
LOG.error("Message:{0}".format(m))
result['result'] = False
result['comment'] = 'Error updating vlan: {0}'.format(name)
@@ -1522,10 +1516,7 @@
maas.post(u"api/2.0/subnets/", None, **data).read())
except Exception as inst:
LOG.debug("create_subnet data:{}".format(data))
- try:
- m = inst.readlines()
- except:
- m = inst.message
+ m = inst.message
LOG.error("Message:{0}".format(m))
result['result'] = False
result['comment'] = 'Error creating subnet: {0}'.format(name)
@@ -1617,10 +1608,7 @@
json_res = json.loads(
maas.post(u"api/2.0/ipranges/", None, **data).read())
except Exception as inst:
- try:
- m = inst.readlines()
- except:
- m = inst.message
+ m = inst.message
LOG.error("Message:{0}".format(m))
result['result'] = False
result['comment'] = 'Error creating iprange:{0}'.format(_name)
@@ -1966,7 +1954,7 @@
maas.post(u'api/2.0/boot-sources/{0}/selections/'.format(bs_id), None,
**data).read())
except Exception as inst:
- m = inst.readlines()
+ m = inst.message
LOG.warning("boot_source_selections "
"catch error during processing. Most-probably, "
"streams data not imported yet.\nSleep:{}s "