summaryrefslogtreecommitdiffstats
path: root/cobbler/remote.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-04-22 17:47:39 -0400
committerMichael DeHaan <mdehaan@redhat.com>2008-04-22 17:47:39 -0400
commit11d6201018d14319f8227f67ccaed575e8ef35d8 (patch)
treef27609059293258e12dfa9798913dbbd8caec6f8 /cobbler/remote.py
parentc382a735c28c3453d181e304078e2f14a9df98c6 (diff)
downloadthird_party-cobbler-11d6201018d14319f8227f67ccaed575e8ef35d8.tar.gz
third_party-cobbler-11d6201018d14319f8227f67ccaed575e8ef35d8.tar.xz
third_party-cobbler-11d6201018d14319f8227f67ccaed575e8ef35d8.zip
Auto registration now tested and confirmed to work (if you have it enabled in settings)
Diffstat (limited to 'cobbler/remote.py')
-rw-r--r--cobbler/remote.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/cobbler/remote.py b/cobbler/remote.py
index d9ec275..c25e700 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -192,7 +192,7 @@ class CobblerXMLRPCInterface:
self.api.add_system(system)
- def register_mac(self,mac,token=None):
+ def register_mac(self,mac,profile,token=None):
"""
If allow_cgi_register_mac is enabled in settings, this allows
kickstarts to add new system records for per-profile-provisioned
@@ -202,20 +202,30 @@ class CobblerXMLRPCInterface:
"""
if mac is None:
+ # don't go further if not being called by anaconda
return 1
if not self.api.settings().register_new_installs:
+ # must be enabled in settings
return 2
system = self.api.find_system(mac_address=mac)
- if system is not None:
+ if system is not None:
+ # do not allow overwrites
return 3
+ # the MAC probably looks like "eth0 AA:BB:CC:DD:EE:FF" now, fix it
+ if mac.find(" ") != -1:
+ mac = mac.split()[-1]
+
+ self.log("register mac for profile %s" % profile,token=token,name=mac)
obj = self.api.new_system()
obj.set_profile(profile)
- obj.set_name(mac.replace(":","_"))
+ name = mac.replace(":","_")
+ obj.set_name(name)
obj.set_mac_address(mac, "intf0")
- systems.add(obj,save=True)
+ obj.set_netboot_enabled(False)
+ self.api.add_system(obj)
return 0
def disable_netboot(self,name,token=None):