diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py index 64d8f8ddf88..d9f30e5ab49 100644 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py @@ -21,6 +21,7 @@ from netaddr import * def merge(dbag, data): + search(dbag, data['host_name']) # A duplicate ip address wil clobber the old value # This seems desirable .... if "add" in data and data['add'] is False and \ @@ -31,3 +32,18 @@ def merge(dbag, data): else: dbag[data['ipv4_adress']] = data return dbag + + +def search(dbag, name): + """ + Dirty hack because CS does not deprovision hosts + """ + hosts = [] + for o in dbag: + if o == 'id': + continue + print "%s %s" % (dbag[o]['host_name'], name) + if dbag[o]['host_name'] == name: + hosts.append(o) + for o in hosts: + del(dbag[o])