List,
I'm trying to script inserting new systems into cobbler and I wrote
the below code using the cobbler api. I'm finding that it creates the
system but it's not available in the webUI until I've done a service
cobbler restart. Is there a way around that so it's available
immediately after it's saved with out having to restart cobblerd?
#!/usr/bin/python
import sys
from cobbler import api
from cobbler.cexceptions import CX
ch = api.BootAPI()
system_name="testbox"
intname='eth1'
# If the system doesn't exist create it
thissys = ch.find_system(name="%s" % system_name)
if thissys is None:
thissys = ch.new_system()
try:
thissys.set_profile("default")
thissys.set_name("testing")
thissys.set_hostname("testing")
thissys.set_gateway("192.168.69.1")
thissys.set_dns_name("testing-blahr", intname)
thissys.set_static("True", intname)
thissys.set_mac_address("00:1C:23:C9:DB:51", intname)
thissys.set_ip_address("192.168.69.10", intname)
thissys.set_subnet("255.255.255.0", intname)
thissys.set_mtu("", intname)
thissys.set_static_routes("something", intname)
except CX, reason:
print "ERROR: %s" % reason.value
sys.exit(1)
ch.add_system(thissys, save=True)
ch.sync()
sys.exit(0)
Show replies by date