mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(instances): clone name and MAC read the same dhcpd.conf
An optional dhcpd.conf next to the application supplies clone names and their MAC addresses. get_dhcp_mac_address read it from BASE_DIR, but guess_clone_name from a fixed /srv/webvirtcloud/dhcpd.conf, so on any other install path the Guess button found no name while the MAC lookup still worked. Both use utils.dhcpd_conf() (BASE_DIR) now.
This commit is contained in:
parent
80a94a36b6
commit
5c4eb97410
3 changed files with 28 additions and 3 deletions
|
|
@ -231,8 +231,14 @@ def refr(compute):
|
|||
refresh_instance_database(compute)
|
||||
|
||||
|
||||
def dhcpd_conf():
|
||||
"""Optional dhcpd.conf in the application directory; clone names and MAC
|
||||
addresses are taken from its host entries when it exists."""
|
||||
return os.path.join(str(settings.BASE_DIR), "dhcpd.conf")
|
||||
|
||||
|
||||
def get_dhcp_mac_address(vname):
|
||||
dhcp_file = str(settings.BASE_DIR) + "/dhcpd.conf"
|
||||
dhcp_file = dhcpd_conf()
|
||||
mac = ""
|
||||
if os.path.isfile(dhcp_file):
|
||||
with open(dhcp_file, "r") as f:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue