Handle empty None-type hostname
This commit is contained in:
parent
46c5e8e36c
commit
e7bc4f7328
|
@ -108,6 +108,8 @@ def read_lease_database(zk_conn, zk_leases_key):
|
||||||
print('\n'.join(output_list))
|
print('\n'.join(output_list))
|
||||||
|
|
||||||
def add_lease(zk_conn, zk_leases_key, expiry, macaddr, ipaddr, hostname, clientid):
|
def add_lease(zk_conn, zk_leases_key, expiry, macaddr, ipaddr, hostname, clientid):
|
||||||
|
if not hostname:
|
||||||
|
hostname = ''
|
||||||
transaction = zk_conn.transaction()
|
transaction = zk_conn.transaction()
|
||||||
transaction.create('{}/{}'.format(zk_leases_key, macaddr), ''.encode('ascii'))
|
transaction.create('{}/{}'.format(zk_leases_key, macaddr), ''.encode('ascii'))
|
||||||
transaction.create('{}/{}/expiry'.format(zk_leases_key, macaddr), expiry.encode('ascii'))
|
transaction.create('{}/{}/expiry'.format(zk_leases_key, macaddr), expiry.encode('ascii'))
|
||||||
|
|
Loading…
Reference in New Issue