Cleanups for mac handling
This commit is contained in:
parent
8078ffae5a
commit
12e8ccd01c
2 changed files with 2 additions and 6 deletions
|
@ -60,9 +60,6 @@ class MAC(object):
|
||||||
return ':'.join(format(s, '02x') for s in b)
|
return ':'.join(format(s, '02x') for s in b)
|
||||||
|
|
||||||
def get_next(self, vmuuid=None, as_int=False):
|
def get_next(self, vmuuid=None, as_int=False):
|
||||||
# if self.free:
|
|
||||||
# return self.free.pop()
|
|
||||||
|
|
||||||
last_number = self.last_used_index()
|
last_number = self.last_used_index()
|
||||||
|
|
||||||
# FIXME: compare to 48bit minus prefix length
|
# FIXME: compare to 48bit minus prefix length
|
||||||
|
@ -81,7 +78,7 @@ class MAC(object):
|
||||||
db_entry['mac_address'] = next_mac
|
db_entry['mac_address'] = next_mac
|
||||||
|
|
||||||
self.db.set("used/{}".format(next_mac),
|
self.db.set("used/{}".format(next_mac),
|
||||||
db_entry)
|
db_entry, as_json=True)
|
||||||
|
|
||||||
if as_int:
|
if as_int:
|
||||||
return next_mac_number
|
return next_mac_number
|
||||||
|
|
|
@ -25,5 +25,4 @@ def main(arguments):
|
||||||
print(m.last_used_mac())
|
print(m.last_used_mac())
|
||||||
|
|
||||||
if arguments['get_new_mac']:
|
if arguments['get_new_mac']:
|
||||||
m = MAC(config).get_next()
|
print(MAC(config).get_next())
|
||||||
print(m.last_used())
|
|
||||||
|
|
Loading…
Reference in a new issue