Skip to content

Commit e338f35

Browse files
author
Niels Basjes
committed
Fixed dnsmasq issue regarding missing dhcp-host entries
1 parent 83bf9d1 commit e338f35

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

cobbler/modules/manage_dnsmasq.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,24 +121,28 @@ def write_dhcp_file(self):
121121
continue
122122

123123
counter = counter + 1
124-
systxt = ""
125124

126-
# dnsmasq. don't have to write IP and other info here, but we do tag
127-
# each MAC based on the arch of it's distro, if it needs something other
128-
# than pxelinux.0 -- for these arches, and these arches only, a dnsmasq
129-
# reload (full "cobbler sync") would be required after adding the system
130-
# to cobbler, just to tag this relationship.
125+
# In many reallife situations there is a need to control the IP address
126+
# and hostname for a specific client when only the MAC address is available.
127+
# In addition to that in some scenarios there is a need to explicitly
128+
# label a host with the applicable architecture in order to correctly
129+
# handle situations where we need something other than pxelinux.0.
130+
# So we always write a dhcp-host entry with as much info as possible
131+
# to allow maximum control and flexibility within the dnsmasq config
132+
133+
systxt = "dhcp-host=net:" + distro.arch.lower() + "," + mac
134+
135+
if host is not None and host != "":
136+
systxt = systxt + "," + host
131137

132138
if ip is not None and ip != "":
133-
if distro.arch.lower() == "ia64":
134-
systxt = "dhcp-host=net:ia64," + ip + "\n"
135-
# support for other arches needs modifications here
136-
else:
137-
systxt = ""
139+
systxt = systxt + "," + ip
140+
141+
systxt = systxt + "\n"
138142

139143
dhcp_tag = interface["dhcp_tag"]
140144
if dhcp_tag == "":
141-
dhcp_tag = "default"
145+
dhcp_tag = "default"
142146

143147
if not system_definitions.has_key(dhcp_tag):
144148
system_definitions[dhcp_tag] = ""

0 commit comments

Comments
 (0)