do not clean ip from vlan if it is no assigned

This commit is contained in:
deflax 2018-02-02 17:24:09 +02:00
parent 6f3530095f
commit 40c20abddc

View file

@ -184,9 +184,11 @@ def remove(unit_id=0):
try:
#pubvlans depends on deploy as foreign key so delete them first
for pubvlan in deploy.inv_pubvlans:
pubvlan.pubaddr.pubvlan_id = None
pubvlan.pubaddr.user_id = None
db.session.commit()
#clean public addr assignment
if pubvlan.pubaddr != None:
pubvlan.pubaddr.pubvlan_id = None
pubvlan.pubaddr.user_id = None
db.session.commit()
db.session.delete(pubvlan)
db.session.commit()