Attached is a patch for
/usr/lib/python2.4/site-packages/cobbler/services.py, which allows
findks to match based on the MAC address.
The patch is relative to the version from
http://git.fedoraproject.org/git/?p=cobbler;a=commit;h=482d5494c13f1fbeb5ee59a2e1d5431f50e9c501
--- services.py.git 2008-07-21 13:23:16.000000000 +0200
+++ services.py 2008-07-21 14:19:47.000000000 +0200
@@ -93,2 +93,2 @@
self.__xmlrpc_setup()
systems = self.remote.get_systems()
+ candidates = []
+
# if kssendmac was in the kernel options line, see
# if a system can be found matching the MAC address. This
# is more specific than an IP match.
@@ -101,3 +103,13 @@
if macinput is not None:
# FIXME: will not key off other NICs, problem?
mac = macinput.split()[1].strip()
+
+ for x in systems:
+ for y in x["interfaces"]:
+ if x["interfaces"][y]["mac_address"].lower() ==
mac.lower():
+ candidates.append(x)
+
+ if len(candidates) > 1:
+ return "FAILED: multiple matches based on MAC"
+ elif len(candidates) == 1:
+ return candidates[0]["name"]
ip = rest["REMOTE_ADDR"]
- candidates = []
for x in systems:
for y in x["interfaces"]:
if x["interfaces"][y]["ip_address"] == ip:
@@ -113,6 +124,6 @@
if len(candidates) == 0:
return "FAILED: no match (%s,%s)" % (ip, macinput)
elif len(candidates) > 1:
- return "FAILED: multiple matches"
+ return "FAILED: multiple matches based on IP"
elif len(candidates) == 1:
return candidates[0]["name"]
_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler