mirror of https://github.com/apache/cloudstack.git
Check both ip and hosts when building dhcp bag
This commit is contained in:
parent
c1ec5b0b16
commit
748e2e51a9
|
|
@ -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])
|
||||
|
|
|
|||
Loading…
Reference in New Issue