yum upgrade to 1.2.6-1.el5
by Harry Hoffman
Just upgraded to the latest cobbler from epel-testing... the
post-install script fails :-(
Updating : cobbler ####################### [ 5/10]
profile CentOS-5.2-x86_64 not found, inheritance not possible
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: Traceback (most recent call last):
File "/usr/bin/cobblerd", line 32, in ?
api = bootapi.BootAPI()
File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 90, in
__init__
self.deserialize()
File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 448, in
deserialize
return self._config.deserialize()
File "/usr/lib/python2.4/site-packages/cobbler/config.py", line 186,
in deserialize
serializer.deserialize(self._profiles)
File "/usr/lib/python2.4/site-packages/cobbler/serializer.py", line
125, in deserialize
rc = storage_module.deserialize(obj,topological)
File
"/usr/lib/python2.4/site-packages/cobbler/modules/serializer_yaml.py",
line 136, in deserialize
obj.from_datastruct(datastruct)
File "/usr/lib/python2.4/site-packages/cobbler/collection.py", line
144, in from_datastruct
item = self.factory_produce(self.config,seed_data)
File
"/usr/lib/python2.4/site-packages/cobbler/collection_profiles.py", line
41, in factory_produce
return profile.Profile(config).from_datastruct(seed_data)
File "/usr/lib/python2.4/site-packages/cobbler/item_profile.py", line
87, in from_datastruct
self.set_parent(self.parent)
File "/usr/lib/python2.4/site-packages/cobbler/item_profile.py", line
131, in set_parent
raise CX(_("profile %s not found, inheritance not possible") %
parent_name)
cobbler.cexceptions.CX: 'profile CentOS-5.2-x86_64 not found,
inheritance not possible'
[FAILED]
error: %post(cobbler-1.2.6-1.el5.noarch) scriptlet failed, exit status 1
Any ideas?
Cheers,
Harry
14 years, 8 months
PXE boot sub menu's
by Glenn Bailey
Now I'm not sure if this is even possible, but I thought I'd throw it out there. Basically, having submenus within the PXE boot menu. An example would be the following:
CentOS
- CentOS 4
- i386
- Web build
- App build
- Dev build
- x86_64
- CentOS 5
- i386
- x86_64
- etc
My build process does not include MAC addresses, so we basically have to select the OS then I'll
have some post scripts to pull the chassis serial # for configuration info from a config database.
Just wanted something a bit cleaner that the default method, but of course this is just me being
anal ;-)
--
glenn
terremark worldwide
15 years, 1 month
For those seeing problems with the 1.4.X webapp saving system files occasionally as zero length...
by Michael DeHaan
There's been a bug reported a few times that we don't have good
reproduction notes for, at least I can't reproduce it.
It involves using the web app, somehow adding more interfaces (possibly)
and then clicking Save to find out that the file saved in
/var/lib/cobbler/config/systems.d is now zero length.
I've heard one report that there was an infinite recursion error in the
log at the time, but I haven't seen it.
I still do not know the root cause for it, or whether it's confined to a
specific OS /but/ I have taken several measures to help isolate and
eliminate the corrupt files from
the web app and would encourage everyone to help test this.
(A) When files are written, we first render them to yaml in memory, the
result is "" we do not write the file.
(B) When an API handle encounteres a blank or corrupted file, an
exception will now indicate what file is damaged so it can be
removed/fixed, rather than getting an obscure
YAML related traceback, allowing the file to be manually removed to
restore proper operation.
I suspect at this point that perhaps a stray character in the input for
some of the fields might be causing the problem, or that perhaps the
data entered cannot be cleanly marshalled
over XMLRPC. However I still can't repro it.
For those that are seeing this, the current git version of cobbler
(master branch) contains the above fixes. Testing is welcome (I plan to
test some more as well as read over the YAML module), but ideally what
we need is for folks to try that code (for safety reasons) and then find
more accurate reproduction notes.
It is /probably/ related to a GIGO sort of error with the input of some
field not being 100% validated and the YAML serializer choking on it, if
I had to guess. In which case, knowing what that input is would be
helpful. I don't really think it should be intermittent based on what
was reported.
I also need to know if the fix in (A) does prevent the error. From
there we can figure out how to make those edits work without incident.
Patch here:
http://git.fedorahosted.org/git/?p=cobbler;a=commitdiff;h=e690e0af16eae2f...
--Michael
15 years, 1 month
Open Roadmap Discussion for 1.5/1.6
by Michael DeHaan
I roadmap in Cobbler doesn't always mean everything as we always take
good patches and ideas as they come along, but I think it's still
important to have a few major features for each release. Here's my
plan. As I see major things going on at the moment for the next
release (I want to start releasing /smaller/ releases more often, rather
than big releases):
-- performance items. Make CLI talk to cobblerd for speedy action in
large configs. Make all operations callable over XMLRPC for better
integration with other apps. (Possibly add better XMLRPC/web search)
-- Windows support (linux-ris work) for mixed environments (I'll
probably end up helping with this too, since it's a rather big feature)
Anyone else see any major themes from the RFE list and things you would
like to see concentrated on for this release or upcoming ones?
https://fedorahosted.org/cobbler/report/1 ?
The ongoing discussion of big things/themes missing is always a good one
to have. We have also collected a lot of great RFE's, so I'm going to
try to organize these further and make it a bit clearer as to what I
think interesting priorities for them are in case folks (including me)
want to knock them out.
I think the ongoing work on SuSE/Debian is also very good stuff, so
folks who are working on that, that's great -- it need not be aligned to
any release, though I think getting things packaged up there could
increase the userbase nicely. Let me know if there are any concerns in
that area. I see packaging (Debian+SuSE) and SuSE imports as some of
the larger missing parts in that area to increase the world domination
factor :)
--Michael
15 years, 2 months
Re: ris-linux review pending
by Jeroen van Meeuwen
James Cammarata wrote:
> Do you know if all of the windows pxe boot files have to be in the root
> directory of the tftp server? I would like to create subdirectories like
> this:
>
> /tftpboot/ris/profiles/$profile_name/startrom.n12 -> /tftpboot/winxp.0
> /NTLDR -> /tftpboot/XPLDR
> /winnt.sif
> /winxp ->
> /var/www/cobbler/ks_mirror/winxp
>
> And then the pxeboot line would be:
>
> label winxp
> kernel ris/profiles/$profile_name/startrom.n12
>
> label xpsystem1
> kernel ris/systems/$system_name/startrom.n12
>
You can't. startrom will look for a file in the TFTP root; unless you
rewrite the location with tftpd.rules (or the like), it needs to be in
the TFTP root.
That said, when going down the rewrite road to have Windows pick up the
appropriate file(s), it needs to ask for different files to begin with
or the rewrite will cause it to pick up the same file after all.
That said, you can sed -i -e 's/winnt.sif/12345.sif/g' NTLDR to specify
an alternative to "winnt.sif". As such, you can have profiles based on
these three files:
startrom.n12 which points to NTDLR,
NTLDR which points to winnt.sif,
and winnt.sif
Note how the latter two contain 5 chars (excluding the .sif suffix), and
the name of startrom.n12 really doesn't matter.
You could create a:
xp321.0 from startrom.n12,
sed -i -e 's/NTLDR/xp321/g' xp321.0
xp321 from NTLDR,
sed -i -e 's/winnt.sif/xp321.sif/g' xp321
create a xp321.sif file
Note that in this case I use Windows _XP_ _32_-bit Profile #_1_ as the
five chars to use, but those are up to you.
bootfont.bin, ntdetwxp.x86 can just live in the TFTP root since they can
be shared and do not refer to other files.
Now, creating a Cobbler profile or system can grab the originals, copy
them anywhere, replace whatever they want to replace, and as such create
"a unique" unattended installation. With unique filenames per profile
however, you would not necessarily need to create a subdirectory in the
TFTP root however it gets messy fast, so creating one subdirectory
entirely managed by Cobbler probably makes the most sense, provided a
rewrite rule for TFTP.
I'm working on some more documentation about this and more different
Windows unattended installations over the network / using PXE on
http://www.kanarip.com/courses/ClassRoomManual-WindowsInstallationsOverTh...
> The problem will arise if Windows expects the winnt.sif file to be in the
> root of the tftp server, and not in the same directory as the startrom.n12
> file. We may be able to get around this by adding a rewrite rule for tftp
> (as part of the cobbler sync process the rules file would be regenerated
> and tftpd would be HUP'd), so that it hides the fact that things are not
> all in the tftp root.
>
re-writing "/winnt.sif" to anything else will always cause you to
eventually end up with the same file, just from a different location.
> Doing it this way, we will be able to have custom .sif's for each
> system/profile that is created. Otherwise, we will have to come up with
> some way to modify the binaries in a unique way for each system, which I
> really don't want.
Modifying binaries is all you can do when all you get is binaries.
For systems (and profiles), referring to one or the other startrom.n12
file would suffice to differentiate. The NTLDR and .sif used from that
point can be set with a simple sed command like the few in my examples.
This of course could also be done on-the-fly, possibly by Cobbler.
Note that for Windows XP, using the startrom.n12 from Windows 2003 is
basically your only option or it won't ever find txtsetup.sif although
the error message will be garbled beyond recognition.
The entire profile/system directory may be a link to
> another folder somewhere in /var/www/cobbler, just for cleanliness reasons.
>
in.tftpd does not handle links very well.
Kind regards,
Jeroen van Meeuwen
-kanarip
15 years, 2 months
[PATCH] Add snippet to maintain persistent ssh host keys across re-kickstarts
by Jeff Schroeder
From: Jeff Schroeder <jeffschroeder(a)computer.org>
The original idea is from Garrick Staples @ USC. My implementation is
designed to work on crazy raid controllers like in HP servers that show
/dev/cciss/c0d0 or normal servers that show /dev/sda. This assumes that
the list-harddrives command is available. It is part of anaconda and
might not be available on SUSE or other non Redhat based distributions.
Signed-off-by: Jeff Schroeder <jeffschroeder(a)computer.org>
---
snippets/keep_ssh_host_keys | 44 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
create mode 100644 snippets/keep_ssh_host_keys
diff --git a/snippets/keep_ssh_host_keys b/snippets/keep_ssh_host_keys
new file mode 100644
index 0000000..93a6fad
--- /dev/null
+++ b/snippets/keep_ssh_host_keys
@@ -0,0 +1,44 @@
+#raw
+# Nifty trick to restore ssh keys without using a nochroot %post
+
+echo "Saving ssh host keys..." > /dev/ttyS0
+
+keys_found=no
+
+insmod /lib/jbd.o
+insmod /lib/ext3.o
+
+drives=$(list-harddrives | awk '{print $1}')
+for disk in $drives; do
+ DISKS="$DISKS $(fdisk -l /dev/$disk | awk '/^\/dev/{print $1}')"
+done
+
+for disk in $DISKS; do
+ name=$(basename $disk)
+ mkdir -p /tmp/$name /tmp/ssh
+ mount $disk /tmp/$name
+ [ $? -eq 0 ] || continue # Skip to the next partition if the mount fails
+
+ # Copy current ssh host keys out to be reused
+ if [ -d /tmp/${name}/etc/ssh ]; then
+ cp -a /tmp/${name}/etc/ssh/ssh_host* /tmp/ssh
+ keys_found="yes"
+ umount /tmp/$name
+ break
+ fi
+ umount /tmp/$name
+ rm -r /tmp/$name
+done
+
+# Loop until the ssh rpm is installed
+if [ "$keys_found" = "yes" ]; then
+ while : ; do
+ sleep 10
+ if [ -d /mnt/sysimage/etc/ssh ] ; then
+ cp -f /tmp/ssh/ssh_host* /mnt/sysimage/etc/ssh/
+ logger "SSH-HOST-KEY copied to newly installed system"
+ break
+ fi
+ done &
+fi
+#end
--
1.5.4.3
15 years, 2 months
[PATCH] two small patches
by Dave Hatton
Hi Michael
I've attached two small patches.
1. This sorts to order of systems and profiles on a buildiso .iso.
2. Ensure that directories exist when installing a template-file. The
might be a better way of doing this, but it works for me.
Dave
>From 9c9501c50b49cafacdd60ddfb1a0eb9a811395fd Mon Sep 17 00:00:00 2001
From: Dave Hatton <dave(a)starground.it>
Date: Thu, 29 Jan 2009 20:05:54 +0000
Subject: [PATCH] Sort profiles and systems into order on buildsion menu
---
cobbler/action_buildiso.py | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/cobbler/action_buildiso.py b/cobbler/action_buildiso.py
index 7fa2c5a..eec6054 100644
--- a/cobbler/action_buildiso.py
+++ b/cobbler/action_buildiso.py
@@ -164,7 +164,13 @@ class BuildIso:
cfg.write(HEADER) # fixme, use template
print _("- generating profile list...")
- for profile in self.api.profiles():
+ #sort the profiles
+ profile_list = [profile for profile in self.profiles]
+ def sort_name(a,b):
+ return cmp(a.name,b.name)
+ profile_list.sort(sort_name)
+
+ for profile in profile_list:
use_this = True
if profiles is not None:
which_profiles = profiles.split(",")
@@ -204,7 +210,13 @@ class BuildIso:
cfg.write("\nMENU SEPARATOR\n")
- for system in self.api.systems():
+ #sort the systems
+ system_list = [system for system in self.systems]
+ def sort_name(a,b):
+ return cmp(a.name,b.name)
+ system_list.sort(sort_name)
+
+ for system in system_list:
use_this = False
if systems is not None:
which_systems = systems.split(",")
--
1.5.5.6
>From b0ad11326d627971db7fe4cbeadfcae21de22c44 Mon Sep 17 00:00:00 2001
From: Dave Hatton <dave(a)starground.it>
Date: Fri, 30 Jan 2009 14:38:19 +0000
Subject: [PATCH] make sure the directory exists for a downloaded file
---
snippets/download_config_files | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/snippets/download_config_files b/snippets/download_config_files
index 865c43a..0444311 100644
--- a/snippets/download_config_files
+++ b/snippets/download_config_files
@@ -11,6 +11,7 @@
#end if
#set $turl = "http://"+$http_server+"/cblr/svc/op/template/"+$ttype+"/"+$tname+"/path/"+$tpath
#if $orig.startswith("/")
+mkdir -p `dirname $orig`
wget "$turl" --output-document="$orig"
#end if
#end for
--
1.5.5.6
15 years, 2 months
Network setup snippet with un-wanted eth0
by Simon Woolsgrove
I just noticed this with the new network snippet in 1.4.1.
If I add a system and only configure say eth5, cobbler adds eth0 I get say
interface : eth0
mac address :
bonding :
bonding_master :
bonding_opts :
is static? : False
ip address :
subnet :
static routes : []
dns name :
dhcp tag :
virt bridge :
interface : eth5
mac address : 00:xx:xx:xx:xx:xx
bonding :
bonding_master :
bonding_opts :
is static? : False
ip address :
subnet :
static routes : []
dns name :
dhcp tag :
virt bridge :
The network snippet renders this as
# --- Network ---
# Network information
# Using "old" style networking config. Make sure all MAC-addresses are in cobbler to use the new-style config
network --bootproto=dhcp --hostname=fred --device=eth0 --onboot=on
network --bootproto=dhcp --device=eth1 --onboot=on
It goes into old style as no mac has been assigned to eth0 (unwanted interface).
Making the following change fixes this
diff --git a/snippets/network_config b/snippets/network_config
index 001aa50..a1ab5e4 100644
--- a/snippets/network_config
+++ b/snippets/network_config
@@ -61,7 +61,7 @@
#end if
## network details are populated from the cobbler system object
#if $is_vlan == "false"
-network $network_str --device=eth$i --onboot=on
+network $network_str --device=$iname --onboot=on
#end if
#end for
#end if
# --- Network ---
# Network information
# Using "old" style networking config. Make sure all MAC-addresses are in cobbler to use the new-style config
# found interface eth5 processing ...
network --bootproto=dhcp --hostname=fred --device=eth5 --onboot=on
# found interface eth0 processing ...
network --bootproto=dhcp --device=eth0 --onboot=on
Adding the mac address for eth0 fixes the issue as it jumps to the pre_install_network_config snippet. I guess when eth0 is allowed to be removed would fix this use case. But will still happen if old style is employed with non consecutive interfaces.
Cheers,
Simon
15 years, 2 months
[PATCH] -name-servers-search option
by Dave Hatton
Here is a (hopefully) finished patch to add a DNS search path.
Regarding the webui;
1. I noticed that for name servers it was suggesting a space separated
list, but I think from the code this should be comma separated. So I
altered this.
2. I altered the width of a number of field to hopefully improve the looks.
Dave Hatton
>From 9003c34fa90d1619df3b5ad3eee359f57cc25369 Mon Sep 17 00:00:00 2001
From: Dave Hatton <dave(a)starground.it>
Date: Tue, 27 Jan 2009 22:51:46 +0000
Subject: [PATCH] Added name server serach path support
---
cobbler/item_profile.py | 10 ++++++++++
cobbler/item_system.py | 10 ++++++++++
cobbler/modules/cli_profile.py | 3 +++
cobbler/modules/cli_system.py | 3 +++
cobbler/remote.py | 2 ++
cobbler/settings.py | 1 +
cobbler/webui/CobblerWeb.py | 6 ++++--
snippets/post_install_network_config | 8 ++++++++
webui_templates/system_edit.tmpl | 23 +++++++++++++++++++----
9 files changed, 60 insertions(+), 6 deletions(-)
diff --git a/cobbler/item_profile.py b/cobbler/item_profile.py
index d30eb52..90cf782 100644
--- a/cobbler/item_profile.py
+++ b/cobbler/item_profile.py
@@ -69,6 +69,7 @@ class Profile(item.Item):
self.ctime = 0
self.mtime = 0
self.name_servers = (self.settings.default_name_servers, '<<inherit>>')[is_subobject]
+ self.name_servers_search = (self.settings.default_name_servers_search, '<<inherit>>')[is_subobject]
self.redhat_management_key = "<<inherit>>"
def from_datastruct(self,seed_data):
@@ -95,6 +96,7 @@ class Profile(item.Item):
self.ctime = self.load_item(seed_data,'ctime',0)
self.mtime = self.load_item(seed_data,'mtime',0)
self.name_servers = self.load_item(seed_data,'name_servers',[])
+ self.name_servers_search = self.load_item(seed_data,'name_servers_search',[])
self.redhat_management_key = self.load_item(seed_data,'redhat_management_key', '<<inherit>>')
# backwards compatibility
@@ -184,6 +186,11 @@ class Profile(item.Item):
self.name_servers = data
return True
+ def set_name_servers_search(self,data):
+ data = utils.input_string_or_list(data)
+ self.name_servers_search = data
+ return True
+
def set_enable_menu(self,enable_menu):
"""
Sets whether or not the profile will be listed in the default
@@ -304,6 +311,7 @@ class Profile(item.Item):
'ctime' : self.ctime,
'mtime' : self.mtime,
'name_servers' : self.name_servers,
+ 'name_servers_search' : self.name_servers_search,
'uid' : self.uid,
'random_id' : self.random_id,
'redhat_management_key' : self.redhat_management_key
@@ -328,6 +336,7 @@ class Profile(item.Item):
buf = buf + _("mgmt classes : %s\n") % self.mgmt_classes
buf = buf + _("modified : %s\n") % time.ctime(self.mtime)
buf = buf + _("name servers : %s\n") % self.name_servers
+ buf = buf + _("name servers search : %s\n") % self.name_servers_search
buf = buf + _("owners : %s\n") % self.owners
buf = buf + _("post kernel options : %s\n") % self.kernel_options_post
buf = buf + _("redhat mgmt key : %s\n") % self.redhat_management_key
@@ -379,6 +388,7 @@ class Profile(item.Item):
'mgmt_classes' : self.set_mgmt_classes,
'comment' : self.set_comment,
'name_servers' : self.set_name_servers,
+ 'name_servers_search' : self.set_name_servers_search,
'redhat_management_key' : self.set_redhat_management_key
}
diff --git a/cobbler/item_system.py b/cobbler/item_system.py
index 91a7f62..355cb6c 100644
--- a/cobbler/item_system.py
+++ b/cobbler/item_system.py
@@ -74,6 +74,7 @@ class System(item.Item):
self.hostname = ""
self.gateway = ""
self.name_servers = ""
+ self.name_servers_search = ""
self.bonding = ""
self.bonding_master = ""
self.bonding_opts = ""
@@ -175,6 +176,7 @@ class System(item.Item):
self.hostname = self.load_item(seed_data, 'hostname', __hostname)
self.name_servers = self.load_item(seed_data, 'name_servers', '<<inherit>>')
+ self.name_servers_search = self.load_item(seed_data, 'name_servers_search', '<<inherit>>')
self.redhat_management_key = self.load_item(seed_data, 'redhat_management_key', '<<inherit>>')
# virt specific
@@ -448,6 +450,11 @@ class System(item.Item):
self.name_servers = data
return True
+ def set_name_servers_search(self,data):
+ data = utils.input_string_or_list(data)
+ self.name_servers_search = data
+ return True
+
def set_subnet(self,subnet,interface):
intf = self.__get_interface(interface)
intf["subnet"] = subnet
@@ -662,6 +669,7 @@ class System(item.Item):
'hostname' : self.hostname,
'gateway' : self.gateway,
'name_servers' : self.name_servers,
+ 'name_servers_search' : self.name_servers_search,
'redhat_management_key' : self.redhat_management_key
}
@@ -681,6 +689,7 @@ class System(item.Item):
buf = buf + _("modified : %s\n") % time.ctime(self.mtime)
buf = buf + _("name servers : %s\n") % self.name_servers
+ buf = buf + _("name servers search : %s\n") % self.name_servers_search
buf = buf + _("netboot enabled? : %s\n") % self.netboot_enabled
buf = buf + _("owners : %s\n") % self.owners
buf = buf + _("server : %s\n") % self.server
@@ -787,6 +796,7 @@ class System(item.Item):
'hostname' : self.set_hostname,
'gateway' : self.set_gateway,
'name_servers' : self.set_name_servers,
+ 'name_servers_search' : self.set_name_servers_search,
'redhat_management_key' : self.set_redhat_management_key
}
diff --git a/cobbler/modules/cli_profile.py b/cobbler/modules/cli_profile.py
index 03efb7b..a066680 100644
--- a/cobbler/modules/cli_profile.py
+++ b/cobbler/modules/cli_profile.py
@@ -72,6 +72,7 @@ class ProfileFunction(commands.CobblerFunction):
if not self.matches_args(args,["dumpvars","remove","report","getks","list"]):
p.add_option("--name-servers", dest="name_servers", help="name servers for static setups")
+ p.add_option("--name-servers-search", dest="name_servers_search", help="name servers search path for static setups")
if "copy" in args or "rename" in args:
p.add_option("--newname", dest="newname")
@@ -158,6 +159,8 @@ class ProfileFunction(commands.CobblerFunction):
obj.set_template_files(self.options.template_files,self.options.inplace)
if self.options.name_servers is not None:
obj.set_name_servers(self.options.name_servers)
+ if self.options.name_servers_search is not None:
+ obj.set_name_servers_search(self.options.name_servers_search)
if self.options.redhat_management_key is not None:
obj.set_redhat_management_key(self.options.redhat_management_key)
diff --git a/cobbler/modules/cli_system.py b/cobbler/modules/cli_system.py
index 0c6499d..b69e362 100644
--- a/cobbler/modules/cli_system.py
+++ b/cobbler/modules/cli_system.py
@@ -73,6 +73,7 @@ class SystemFunction(commands.CobblerFunction):
p.add_option("--mac", dest="mac", help="ex: 'AA:BB:CC:DD:EE:FF', (RECOMMENDED)")
p.add_option("--mgmt-classes", dest="mgmt_classes", help="list of config management classes (for Puppet, etc)")
p.add_option("--name-servers", dest="name_servers", help="name servers for static setups")
+ p.add_option("--name-servers-search", dest="name_servers_search", help="name servers search path for static setups")
p.add_option("--redhat-management-key", dest="redhat_management_key", help="authentication token for RHN/Spacewalk/Satellite")
p.add_option("--static-routes", dest="static_routes", help="sets static routes (see manpage)")
p.add_option("--template-files", dest="template_files",help="specify files to be generated from templates during a sync")
@@ -245,6 +246,8 @@ class SystemFunction(commands.CobblerFunction):
obj.set_template_files(self.options.template_files,self.options.inplace)
if self.options.name_servers is not None:
obj.set_name_servers(self.options.name_servers)
+ if self.options.name_servers_search is not None:
+ obj.set_name_servers_search(self.options.name_servers_search)
if self.options.redhat_management_key is not None:
obj.set_redhat_management_key(self.options.redhat_management_key)
diff --git a/cobbler/remote.py b/cobbler/remote.py
index a36ade3..b4e3dee 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -1900,6 +1900,7 @@ def test_xmlrpc_rw():
server.modify_profile(pid, "mgmt-classes", "one two three", token)
server.modify_profile(pid, "comment", "...", token)
server.modify_profile(pid, "name_servers", ["one","two"], token)
+ server.modify_profile(pid, "name_servers_search", ["one","two"], token)
server.modify_profile(pid, "redhat_management_key", "BETA", token)
server.save_profile(pid, token)
@@ -1918,6 +1919,7 @@ def test_xmlrpc_rw():
server.modify_system(sid, 'virt-path', "/opt/images", token)
server.modify_system(sid, 'virt-type', 'qemu', token)
server.modify_system(sid, 'name_servers', 'one two three four', token)
+ server.modify_system(sid, 'name_servers_search', 'one two three four', token)
server.modify_system(sid, 'modify-interface', {
"macaddress-eth0" : "AA:BB:CC:EE:EE:EE",
"ipaddress-eth0" : "192.168.10.50",
diff --git a/cobbler/settings.py b/cobbler/settings.py
index c43987a..6e98680 100644
--- a/cobbler/settings.py
+++ b/cobbler/settings.py
@@ -38,6 +38,7 @@ DEFAULTS = {
"cobbler_master" : '',
"default_kickstart" : "/var/lib/cobbler/kickstarts/default.ks",
"default_name_servers" : '',
+ "default_name_servers_search" : '',
"default_password_crypted" : "\$1\$mF86/UHC\$WvcIcX2t6crBz2onWxyac.",
"default_virt_bridge" : "xenbr0",
"default_virt_type" : "auto",
diff --git a/cobbler/webui/CobblerWeb.py b/cobbler/webui/CobblerWeb.py
index f29a949..72f3659 100644
--- a/cobbler/webui/CobblerWeb.py
+++ b/cobbler/webui/CobblerWeb.py
@@ -512,7 +512,7 @@ class CobblerWeb(object):
def system_save(self,name=None,comment=None,editmode="edit",profile=None,
kopts=None, koptspost=None, ksmeta=None, owners=None, server_override=None, netboot='n',
virtpath=None,virtram=None,virttype=None,virtcpus=None,virtfilesize=None,
- name_servers=None,
+ name_servers=None,name_servers_search=None,
power_type=None, power_user=None, power_pass=None, power_id=None, power_address=None,
gateway=None,hostname=None,redhatmanagementkey=None,delete1=None, delete2=None, **args):
@@ -565,6 +565,7 @@ class CobblerWeb(object):
self.remote.modify_system(system, 'power_id', power_id, self.token)
self.remote.modify_system(system, 'power_address', power_address, self.token)
self.remote.modify_system(system, 'name_servers', name_servers, self.token)
+ self.remote.modify_system(system, 'name_servers_search', name_servers_search, self.token)
self.remote.modify_system(system, 'gateway', gateway, self.token)
self.remote.modify_system(system, 'hostname', hostname, self.token)
self.remote.modify_system(system, 'redhat_management_key', redhatmanagementkey, self.token)
@@ -678,7 +679,7 @@ class CobblerWeb(object):
ksmeta=None,owners=None,enablemenu=None,virtfilesize=None,virtram=None,virttype=None,
virtpath=None,repos=None,dhcptag=None,delete1=False,delete2=False,
parent=None,virtcpus=None,virtbridge=None,subprofile=None,server_override=None,
- name_servers=None,redhatmanagementkey=None,recursive=False,**args):
+ name_servers=None,name_servers_search=None,redhatmanagementkey=None,recursive=False,**args):
if not self.__xmlrpc_setup():
return self.xmlrpc_auth_failure()
@@ -745,6 +746,7 @@ class CobblerWeb(object):
self.remote.modify_profile(profile, 'server', server_override, self.token)
self.remote.modify_profile(profile, 'comment', comment, self.token)
self.remote.modify_profile(profile, 'name_servers', name_servers, self.token)
+ self.remote.modify_profile(profile, 'name_servers_search', name_servers_search, self.token)
self.remote.modify_profile(profile, 'redhat_management_key', redhatmanagementkey, self.token)
if repos is None:
diff --git a/snippets/post_install_network_config b/snippets/post_install_network_config
index a0538bd..a50c761 100644
--- a/snippets/post_install_network_config
+++ b/snippets/post_install_network_config
@@ -204,6 +204,14 @@ echo "BOOTPROTO=dhcp" >> $devfile
#set $nct = $nct + 1
echo "DNS$nct=$nameserver" >> $devfile
#end for
+ #if $name_servers_search != ""
+sed -i -e "/^search /d" /etc/resolv.conf
+echo -n "search " >>/etc/resolv.conf
+ #for $nameserversearch in $name_servers_search
+echo -n "$nameserversearch " >>/etc/resolv.conf
+ #end for
+echo "" >>/etc/resolv.conf
+ #end if
#for $route in $static_routes
#set routepattern = $re.compile("[0-9/.]+:[0-9.]+")
#if $routepattern.match($route)
diff --git a/webui_templates/system_edit.tmpl b/webui_templates/system_edit.tmpl
index 92cd057..7cad60a 100644
--- a/webui_templates/system_edit.tmpl
+++ b/webui_templates/system_edit.tmpl
@@ -533,9 +533,9 @@ redhatmanagementkey"
</td>
<td class="netedit">
#if $system
- <input type="text" size="64" style="width: 150px;" name="hostname" id="hostname" value="$system.hostname" />
+ <input type="text" size="64" style="width: 200px;" name="hostname" id="hostname" value="$system.hostname" />
#else
- <input type="text" size="64" style="width: 150px;" name="hostname" id="hostname" />
+ <input type="text" size="64" style="width: 200px;" name="hostname" id="hostname" />
#end if
<p class="context-tip">Ex: "vanhalen.example.org". Used for /etc/sysconfig/network.</p>
</td>
@@ -563,15 +563,30 @@ redhatmanagementkey"
<td class="netedit">
#if $system
#set joined = " ".join($system.name_servers)
- <input type="text" name="name_servers" id="name_servers" value="$joined">
+ <input type="text" size="255" style="width: 400px;" name="name_servers" id="name_servers" value="$joined" />
#else
- <input type="text" name="name_servers" id="name_servers" value="<<inherit>>">
+ <input type="text" size="255" style="width: 400px;" name="name_servers" id="name_servers" value="<<inherit>>" />
#end if
<p class="context-tip">Name servers, space delimited, if not provided by DHCP</p>
</td>
</tr>
<tr>
+ <td class="netedit">
+ <label for="name_servers_search">Name Servers Search Path</label>
+ </td>
+ <td class="netedit">
+ #if $system
+ #set joined = " ".join($system.name_servers_search)
+ <input type="text" size="255" style="width: 400px;" name="name_servers_search" id="name_servers_search" value="$joined">
+ #else
+ <input type="text" size="255" style="width: 400px;" name="name_servers_search" id="name_servers_search" value="<<inherit>>">
+ #end if
+ <p class="context-tip">Name servers search path, space delimited, if not provided by DHCP</p>
+ </td>
+ </tr>
+
+ <tr>
<td class="virtedit">
<label for="virtfilesize">Virt Disk (GB)</label>
</td>
--
1.5.5.6
>From 24116fde0e4ab8f680b12344db122ba2a06c0e55 Mon Sep 17 00:00:00 2001
From: Dave Hatton <dave(a)starground.it>
Date: Wed, 28 Jan 2009 13:59:19 +0000
Subject: [PATCH] added name_servers_search - added to webgui
---
webui_templates/profile_edit.tmpl | 23 +++++++++++++++++++----
webui_templates/system_edit.tmpl | 12 ++++++------
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/webui_templates/profile_edit.tmpl b/webui_templates/profile_edit.tmpl
index 960d580..a1363dd 100644
--- a/webui_templates/profile_edit.tmpl
+++ b/webui_templates/profile_edit.tmpl
@@ -245,12 +245,27 @@ function disablename(value)
</td>
<td>
#if $profile
- #set joined = " ".join($profile.name_servers)
- <input type="text" name="name_servers" id="name_servers" value="$joined">
+ #set joined = ", ".join($profile.name_servers)
+ <input type="text" size="255" style="width: 400px;" name="name_servers" id="name_servers" value="$joined" />
#else
- <input type="text" name="name_servers" id="name_servers" value="">
+ <input type="text" size="255" style="width: 400px;" name="name_servers" id="name_servers" value="" />
#end if
- <p class="context-tip">Name servers, space delimited, if not provided by DHCP</p>
+ <p class="context-tip">Name servers, comma delimited, if not provided by DHCP</p>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <label for="name_servers_search">Name Servers Search Path</label>
+ </td>
+ <td>
+ #if $profile
+ #set joined = ", ".join($profile.name_servers_search)
+ <input type="text" size="255" style="width: 400px;" name="name_servers_search" id="name_servers_search" value="$joined" />
+ #else
+ <input type="text" size="255" style="width: 400px;" name="name_servers_search" id="name_servers_search" value="" />
+ #end if
+ <p class="context-tip">Name servers search path, comma delimited, if not provided by DHCP</p>
</td>
</tr>
diff --git a/webui_templates/system_edit.tmpl b/webui_templates/system_edit.tmpl
index 7cad60a..372908d 100644
--- a/webui_templates/system_edit.tmpl
+++ b/webui_templates/system_edit.tmpl
@@ -562,12 +562,12 @@ redhatmanagementkey"
</td>
<td class="netedit">
#if $system
- #set joined = " ".join($system.name_servers)
+ #set joined = ", ".join($system.name_servers)
<input type="text" size="255" style="width: 400px;" name="name_servers" id="name_servers" value="$joined" />
#else
<input type="text" size="255" style="width: 400px;" name="name_servers" id="name_servers" value="<<inherit>>" />
#end if
- <p class="context-tip">Name servers, space delimited, if not provided by DHCP</p>
+ <p class="context-tip">Name servers, comma delimited, if not provided by DHCP</p>
</td>
</tr>
@@ -577,12 +577,12 @@ redhatmanagementkey"
</td>
<td class="netedit">
#if $system
- #set joined = " ".join($system.name_servers_search)
- <input type="text" size="255" style="width: 400px;" name="name_servers_search" id="name_servers_search" value="$joined">
+ #set joined = ", ".join($system.name_servers_search)
+ <input type="text" size="255" style="width: 400px;" name="name_servers_search" id="name_servers_search" value="$joined" />
#else
- <input type="text" size="255" style="width: 400px;" name="name_servers_search" id="name_servers_search" value="<<inherit>>">
+ <input type="text" size="255" style="width: 400px;" name="name_servers_search" id="name_servers_search" value="<<inherit>>" />
#end if
- <p class="context-tip">Name servers search path, space delimited, if not provided by DHCP</p>
+ <p class="context-tip">Name servers search path, comma delimited, if not provided by DHCP</p>
</td>
</tr>
--
1.5.5.6
15 years, 2 months
Adding "system tags"
by Dave Hatton
Hi all,
I've been thinking of developing a patch to add some form of system tags
to cobbler.
Initially I was thinking of a number of free format fields.
System_Serial_Number
System_Description
System_Owner
System_Location
Maybe there are some more?
I'm sure this information could help to make the web ui more information?
I was thinking that moving onwards, maybe koan could check the stored
serial number against that reported by the system to prevent accidental
overwrites?.
I'm sure there are other possibilities?
Any thought/suggestions?
Dave Hatton
15 years, 2 months