Re: help with cobbler api script
by Jasper Capel
----- "Jonathan Sabo" <jsabo(a)criminal.org> wrote:
> 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?
>
>
I'm not 100% sure here.
The python API is modifying the datafiles directly if I'm not mistaken (instead of communicating with the cobblerd process), you could try using the XMLRPC API instead. In Cobbler 2.0 I believe the command line utilities have been modified to communicate with the cobblerd process instead of using the python API directly.
See: https://fedorahosted.org/cobbler/wiki/CobblerXmlrpc
Cheers,
Jasper
14 years, 2 months
download repos to host
by Léon Keijser
Hi,
I ran into a problem with hosts that were installed using cobbler, of
which their profile's repositories changed on the cobbler server after
installation. The host's repo definitions were incorrect (yum didn't
work anymore since the baseurl was modified) and needed to be updated.
I wrote a small script that:
- contacts the cobbler server over XMLRPC, specifying a system
- asks what profile exists for the system
- asks what repositories exist for the profile
- downloads the repo's config.repo file
- does some string-replacing (change ${server} to cobbler host)
- saves each repo as a .repo file
get it at:
http://fedorapeople.org/~leon/files/cobbler/download-repos.py
Tested on cobbler 1.6.6 and 2.0.3.1
I hope this is useful to someone.
regards,
Léon
PS: if there's a better way (other than using puppet or something to
manage your repositories), please let me know ;)
14 years, 2 months
help with cobbler api script
by Jonathan Sabo
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)
14 years, 2 months
Authorization problem
by Luc de Louw
Dear all,
I want to prevent several users to make changes to ks templates and
snippets. Normal users should only be able to add/remove and edit
systems.
Any hints on this?
Thanks,
Luc
14 years, 2 months
Disable firewall during cobbler install
by Anu Ramachandra
Hello,
How can the firewall on the target system be disabled during cobbler
install?
The kickstart file has the following statements at the end of the post
section -
Firewall -disabled
Service iptables stop
Chkconfig iptables off
Still, after the install, the firewall is active.
Thanks!
Anu Ramachandra
14 years, 2 months
Running bash script during cobbler install
by Anu Ramachandra
Hello,
We use cobbler to install fedora onto new systems. At the end of the
install, I source a bash script.
I just added a menu to this bash script. I use 'read' to read in the
user's choice. However, when cobbler gets to this point it hangs. The
menu does not come up. The screen shows the message 'Running post
install scripts' and stays this way.
Has anyone used it before? Any ideas on what is missing would help.
Thanks!
Anu Ramachandra
Molecular Imprints Inc,
Austin, TX
512-329-7760
14 years, 2 months