please consider this patch
by Bill Peck
Hello,
I noticed a few problems when importing trees that this patch attempts
to fix. Below is a changelog:
fixed import for s390(x).
fixed import of variants 4Desktop and 4common.
feature: look for kickstarts in the following directory structure on import
/var/lib/cobbler/kickstarts/
-> ARCH/OS_VERSION
-> OS_VERSION
-> ARCH/default.ks
-> default.ks
>From 4303ac9a9aed65c4e6683563c86e5900932b8499 Mon Sep 17 00:00:00 2001
From: Bill Peck <bpeck(a)localhost.localdomain>
Date: Mon, 13 Oct 2008 15:55:07 -0400
Subject: [PATCH] fixed import for s390(x).
fixed import of variants 4Desktop and 4common.
feature: look for kickstarts in the following directory structure on import
/var/lib/cobbler/kickstarts/
-> ARCH/OS_VERSION
-> OS_VERSION
-> ARCH/default.ks
-> default.ks
---
cobbler/action_import.py | 49 +++++++++++++++++++++++++++++++--------------
1 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/cobbler/action_import.py b/cobbler/action_import.py
index babdafd..ce84e29 100644
--- a/cobbler/action_import.py
+++ b/cobbler/action_import.py
@@ -205,7 +205,10 @@ class Importer:
if (self.kickstart_file == None):
kdir = os.path.dirname(distro.kernel)
- base_dir = "/".join(kdir.split("/")[0:-2])
+ if distro.arch == 's390x':
+ base_dir = "/".join(kdir.split("/")[0:-1])
+ else:
+ base_dir = "/".join(kdir.split("/")[0:-2])
for try_entry in TRY_LIST:
try_dir = os.path.join(base_dir, try_entry)
@@ -234,7 +237,10 @@ class Importer:
# find the tree location
dirname = os.path.dirname(distro.kernel)
tokens = dirname.split("/")
- tokens = tokens[:-2]
+ if distro.arch == 's390x':
+ tokens = tokens[:-1]
+ else:
+ tokens = tokens[:-2]
base = "/".join(tokens)
dest_link = os.path.join(self.settings.webdir, "links", distro.name)
@@ -295,25 +301,13 @@ class Importer:
# find the profile kickstart and set the distro breed/os-version based on what
# we can find out from the rpm filenames and then return the kickstart
# path to use.
-
if flavor == "fedora":
-
- # this may actually fail because the libvirt/virtinst database
- # is not always up to date. We keep a simplified copy of this
- # in codes.py. If it fails we set it to something generic
- # and don't worry about it.
distro.set_breed("redhat")
try:
distro.set_os_version("fedora%s" % int(major))
except:
print "- warning: could not store os-version fedora%s" % int(major)
distro.set_os_version("other")
-
- if major >= 8:
- return profile.set_kickstart("/etc/cobbler/sample_end.ks")
- if major >= 6:
- return profile.set_kickstart("/etc/cobbler/sample.ks")
-
if flavor == "redhat" or flavor == "centos":
distro.set_breed("redhat")
if major <= 2:
@@ -326,6 +320,31 @@ class Importer:
print "- warning: could not store os-version %s" % int(major)
distro.set_os_version("other")
+ kickbase = "/var/lib/cobbler/kickstarts"
+ # Look for ARCH/OS_VERSION kickstart first
+ # OS_VERSION next
+ # ARCH/default.ks next
+ # default.ks finally.
+ kickstarts = ["%s/%s/%s" % (kickbase,distro.arch,distro.os_version),
+ "%s/%s" % (kickbase,distro.os_version),
+ "%s/%s/default.ks" % (kickbase,distro.arch),
+ "%s/default.ks" % kickbase]
+ for kickstart in kickstarts:
+ if os.path.exists(kickstart):
+ return profile.set_kickstart(kickstart)
+
+ if flavor == "fedora":
+ # this may actually fail because the libvirt/virtinst database
+ # is not always up to date. We keep a simplified copy of this
+ # in codes.py. If it fails we set it to something generic
+ # and don't worry about it.
+
+ if major >= 8:
+ return profile.set_kickstart("/etc/cobbler/sample_end.ks")
+ if major >= 6:
+ return profile.set_kickstart("/etc/cobbler/sample.ks")
+
+ if flavor == "redhat" or flavor == "centos":
if major >= 5:
return profile.set_kickstart("/etc/cobbler/sample.ks")
@@ -345,7 +364,7 @@ class Importer:
# it may be slightly wrong, but it will be close enough
# for RHEL5 we can get it exactly.
- for x in [ "4AS", "4ES", "4WS" ]:
+ for x in [ "4AS", "4ES", "4WS", "4common", "4Desktop" ]:
if rpm.find(x) != -1:
return ("redhat", 4, 0)
for x in [ "3AS", "3ES", "3WS" ]:
--
1.5.5.1
15 years, 6 months
(devel) Auto removing mirrored content on "remove" commands
by Michael DeHaan
There was a longstanding Trac item that asked for "cobbler distro
remove" to be able to remove data out of ks_mirror. This makes sense,
so I finally added that today.
There are a few limitations that the code will enforce.
If multiple distros reference the same /var/www/cobbler/ks_mirror path,
cobbler will not remove the object until the last one is gone. For
instance if you have a "foo-i386" and a "foo-i386-xen" the equivalent
code to delete /var/www/cobbler/ks_mirror will not be called until the
last one is gone.
This behavior seems reasonable to me and will not attempt to unlink
content that was imported with "--available-as" as that doesn't live in
/var/www/cobbler/ks_mirror.
Another step is to make "cobbler repo remove" also remove repo storage.
(To be done next).
If any of this seems wrong, yell.
--Michael
15 years, 6 months
(devel) Added --static-interface option to Koan
by Jasper Capel
Hey,
Normally, you'd need a DHCP server for installing xenpv virtuals from
Koan: the installer stage1 would send a DHCP request before it fetches
the kickstart file.
You can now run something like:
# koan -s 172.18.3.100 -v -n -y web01.gs.stone-it.local -S eth0
(-S or --static-interface)
And it will append the IP information (ksdevice=, ip=, netmask=,
gateway=) defined in the system for the given interface to the installer
kernel options.
If the interface parameter is "ethX", it will fall back to "intfX", to
allow this to be used on servers upgraded from Cobbler 1.2.x. I also
tested against a Cobbler 1.2.5 server: it works. :)
My changes:
http://bender.newnewyork.nl/git/gitweb.cgi?p=koan/.git;a=summary
or:
git://bender.newnewyork.nl/koan (branch: devel)
Kind regards,
Jasper Capel
Stone-IT
15 years, 6 months
Fix indentation in cobbler/, recognize multiple kernels
by Jeroen van Meeuwen
From: Jeroen van Meeuwen (Fedora Unity) <kanarip(a)fedoraunity.org>
A huge patch (0001) to fix the indentation for all files in cobbler/.
It seemed sometimes 2, 3 or 4 spaces to a tab was used, and editing these
files wasn't becoming any easier. This patch was comprised with a:
$ sed -i -r -e 's/[ ]{4}/\t/g' `find cobbler/ -type f`
$ sed -i -r -e 's/[ ]{3}/\t/g' `find cobbler/ -type f`
$ sed -i -r -e 's/\t/ /g' `find cobbler/ -type f`
making the indentation "4 spaces to a tab".
Another patch (0002) attempts to fix a FIXME wrt. multiple kernels being
available in cobbler.Importer.distro_adder() and cobbler.Importer.add_entry()
15 years, 6 months
[announce] Cobbler 1.2.6 and koan 1.2.6
by Michael DeHaan
Here are some continued miscellaneous fixes for Cobbler and koan:
Cobbler:
- Fri Oct 10 2008 - 1.2.6
- (BUGF) fix image vs system parentage problem affecting cobbler replicate
- (BUGF) fix restart-services trigger to not restart dns unneccessarily
- (BUGF) add missing variable newname to signature for remote copy_
functions
- (BUGF) fix for ownership ownership module when editing kickstarts
Koan:
- Thu Oct 2 2008 Michael DeHaan <mdehaan(a)redhat.com> - 1.2.6-1
- (BUGF) for xenpv installations using --system, pay attention to
--virt-bridge overrides
Users should upgrade if:
-- they want to use the cobbler replicate feature to synchronize or
clone cobbler install servers
-- they are using the ownership module to secure the web application
-- are using Cobbler for DNS management
-- are using koan with xen paravirt and want control over virt bridging
Source RPMs and tarballs are available here:
http://fedorapeople.org/~mdehaan/files/cobbler/
--Michael
15 years, 6 months
users.conf and cobbler/web
by Ronald J. Yacketta
Hello all!
Now that I have things working as I wish from the command line I set out
to dabble in the webui side of cobbler. Currently have cobbler set to-do
ldap authentication via modules.conf as well as added my ldap uid to
users.conf [admins] section. This works like a champ, but, did notice
that if I do not put a uid in the users.conf the following exception is
thrown:
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1229, in _process_target
result = _execute_target(config, req, object, arg)
File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1128, in _execute_target
result = object(arg)
File "/var/www/cobbler/web/index.py", line 123, in handler
content = func( **form )
File "/usr/lib/python2.5/site-packages/cobbler/webui/CobblerWeb.py",
line 768, in ksfile_edit
'deleteable' : not self.remote.is_kickstart_in_use(name,self.token),
File "/usr/lib/python2.5/xmlrpclib.py", line 1150, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.5/xmlrpclib.py", line 1440, in __request
verbose=self.__verbose
File "/usr/lib/python2.5/xmlrpclib.py", line 1204, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.5/xmlrpclib.py", line 1343, in _parse_response
return u.close()
File "/usr/lib/python2.5/xmlrpclib.py", line 790, in close
raise Fault(**self._stack[0])
Fault: <Fault 1: "<type 'exceptions.NameError'>:global name '_' is not
defined">
I searched the wiki and google without any luck :(
-Ron
15 years, 6 months
(devel) cobbler reposync now takes a --tries=N and a --no-fail
by Michael DeHaan
When putting cobbler reposync on crontab occasionally a network problem
can occur that prevents synchronization of a specific repository.
Assume the following commands
Example:
cobbler repo add --name=f9-updates-i386
--mirror=ftp://download.fedora.redhat.com/pub/fedora/linux/updates/9/i386.newkey/
cobbler repo add --name=jimmy-unstable-server-packages
--mirror=http://example.com/repo
cobbler reposync
In the above example, the reposync will fail because there obviously is
no repo there at example.com. That's silly, but here are two reasons
but suppose the server is busy or you have a temporary network glitch.
You still want to synchronize everything else.
In current versions of Cobbler you can still sync repos one and a time,
but that's annoying in a crontab:
cobbler reposync --only=f9-updates-i386
So, to make this /much/ nicer, I added retry logic to "cobbler reposync".
cobbler reposync --tries=3
This will retry each repo 3 times. However, it will still eventually
fail because the example.com repo doesn't exist.
If you want to reposync all repos but not have the failure with one of
them crash the whole thing, you can do:
cobbler reposync --tries=3 --no-fail
This will delay the failure until the end rather than stopping midstream.
Choice of the retry value is up to you. The try number defaults to 1
and "fail early" to be consistent with previous behavior, but this
should make things much nicer for those who want to put reposync on cron.
I'll update the Wiki and (devel branch) manpage to reflect these added
options shortly.
--Michael
15 years, 6 months
XMLRPC API : how to modify dict data
by Alain Barthe
Hello,
I'm new to this list, I'm new to cobbler too : great tool !
I want to create a system from a non cobbler host through XMLRPC. I followed
the wiki and I am ableto create it and to set some scalar value as it is
described in https://fedorahosted.org/cobbler/wiki/CobblerXmlrpc.
But I have to set ks_meta variable that is a sort of dictionary. I tried
several ways without success :
COBSERVER.modify_system(cobid, 'ks_meta', "{'ip': '165.7.120.253',
'netmask': '255.255.255.0', 'hostname': 'blade04', 'gateway': '165.7.120.33'}",
TOKEN)
COBSERVER.modify_system(cobid, 'ks_meta', 'ip=165.7.120.253 netmask=
255.255.255.0 hostname=blade04 gateway=165.7.120.33', TOKEN)
and the same as above with different quoting styles.
The error message is always the same and seems to be weird :
xmlrpclib.Fault: <Fault 1: "exceptions.NameError:global name '_' is not
defined">
By reading the remote.py code, I noted maybe a bug in copy_* function, for
example :
def copy_profile(self,object_id,token=None):
self.log("copy_profile",object_id=object_id,token=token)
self.check_access(token,"copy_profile")
obj = self.__get_object(object_id)
return self.api.copy_profile(obj,newname)
It seems that the "newname" parameter is missing.
Thanks for your help !
Alain.
15 years, 6 months