Handle empty None-type hostname

This commit is contained in:
Joshua Boniface 2020-01-05 22:46:56 -05:00
parent 46c5e8e36c
commit e7bc4f7328
1 changed files with 2 additions and 0 deletions

View File

@ -108,6 +108,8 @@ def read_lease_database(zk_conn, zk_leases_key):
print('\n'.join(output_list))
def add_lease(zk_conn, zk_leases_key, expiry, macaddr, ipaddr, hostname, clientid):
if not hostname:
hostname = ''
transaction = zk_conn.transaction()
transaction.create('{}/{}'.format(zk_leases_key, macaddr), ''.encode('ascii'))
transaction.create('{}/{}/expiry'.format(zk_leases_key, macaddr), expiry.encode('ascii'))