The recently added code to provide DNS servers to the kernel when using
buildiso causes problems when the target systems cannot contact the DNS
servers.
This is highly likely when building with buildiso, since it it intended
for building on isolated networks.
This patch adds the flag --exclude_dns to resolve this problem.
I've attached patches for master and devel and are also available on github.
git://github.com/davehatton/my-cobbler-master.git
git://github.com/davehatton/my-cobbler-devel.git
Thanks
Dave Hatton
From 5e55adc250e8e0cc8f6bc7ca7fe7bca7d868c803 Mon Sep 17 00:00:00 2001
From: Dave Hatton <dave(a)starground.it>
Date: Thu, 26 Mar 2009 23:28:03 +0000
Subject: [PATCH] added --exclude_dns option to buildiso
---
cobbler/action_buildiso.py | 8 ++++----
cobbler/api.py | 4 ++--
cobbler/modules/cli_misc.py | 4 +++-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/cobbler/action_buildiso.py b/cobbler/action_buildiso.py
index 2eebb66..bd5484f 100644
--- a/cobbler/action_buildiso.py
+++ b/cobbler/action_buildiso.py
@@ -83,7 +83,7 @@ class BuildIso:
return str(self.distctr)
- def generate_netboot_iso(self,imagesdir,isolinuxdir,profiles=None,systems=None):
+ def
generate_netboot_iso(self,imagesdir,isolinuxdir,profiles=None,systems=None,exclude_dns=None):
print _("- copying kernels and initrds - for profiles")
# copy all images in included profiles to images dir
for profile in self.api.profiles():
@@ -229,7 +229,7 @@ class BuildIso:
if data.has_key("gateway") and data["gateway"] !=
"":
append_line = append_line + " gateway=%s" %
data["gateway"]
- if data.has_key("name_servers") and
data["name_servers"]:
+ if not exclude_dns and data.has_key("name_servers") and
data["name_servers"]:
append_line = append_line + " dns=%s\n" %
",".join(data["name_servers"])
length=len(append_line)
@@ -329,7 +329,7 @@ class BuildIso:
return
- def
run(self,iso=None,tempdir=None,profiles=None,systems=None,distro=None,standalone=None,source=None):
+ def
run(self,iso=None,tempdir=None,profiles=None,systems=None,distro=None,standalone=None,source=None,exclude_dns=None):
# the distro option is for stand-alone builds only
if not standalone and distro is not None:
@@ -391,7 +391,7 @@ class BuildIso:
if standalone:
self.generate_standalone_iso(imagesdir,isolinuxdir,distro,source)
else:
- self.generate_netboot_iso(imagesdir,isolinuxdir,profiles,systems)
+
self.generate_netboot_iso(imagesdir,isolinuxdir,profiles,systems,exclude_dns)
cmd = "mkisofs -quiet -o %s -r -b isolinux/isolinux.bin -c
isolinux/boot.cat" % iso
cmd = cmd + " -no-emul-boot -boot-load-size 4"
diff --git a/cobbler/api.py b/cobbler/api.py
index fee90f2..85e908c 100644
--- a/cobbler/api.py
+++ b/cobbler/api.py
@@ -710,10 +710,10 @@ class BootAPI:
self.log("authorize",[user,resource,arg1,arg2,rc],debug=True)
return rc
- def
build_iso(self,iso=None,profiles=None,systems=None,tempdir=None,distro=None,standalone=None,source=None):
+ def
build_iso(self,iso=None,profiles=None,systems=None,tempdir=None,distro=None,standalone=None,source=None,
exclude_dns=None):
builder = action_buildiso.BuildIso(self._config)
return builder.run(
- iso=iso, profiles=profiles, systems=systems, tempdir=tempdir, distro=distro,
standalone=standalone, source=source
+ iso=iso, profiles=profiles, systems=systems, tempdir=tempdir, distro=distro,
standalone=standalone, source=source, exclude_dns=exclude_dns
)
def hardlink(self):
diff --git a/cobbler/modules/cli_misc.py b/cobbler/modules/cli_misc.py
index f4c9630..b898f7a 100644
--- a/cobbler/modules/cli_misc.py
+++ b/cobbler/modules/cli_misc.py
@@ -245,6 +245,7 @@ class BuildIsoFunction(commands.CobblerFunction):
p.add_option("--distro", dest="distro",
help="(OPTIONAL) used with --standalone to create a distro-based ISO including all
associated profiles/systems")
p.add_option("--standalone", dest="standalone",
action="store_true", help="(OPTIONAL) creates a standalone ISO with all
required distro files on it")
p.add_option("--source", dest="source",
help="(OPTIONAL) used with --standalone to specify a source for the distribution
files")
+ p.add_option("--exclude_dns", dest="exclude_dns",
action="store_true", help="(OPTIONAL) prevents addition of name server
addresses to the kernel boot options")
def help_me(self):
return HELP_FORMAT % ("cobbler buildiso","[ARGS]")
@@ -260,7 +261,8 @@ class BuildIsoFunction(commands.CobblerFunction):
tempdir=self.options.tempdir,
distro=self.options.distro,
standalone=self.options.standalone,
- source=self.options.source
+ source=self.options.source,
+ exclude_dns=self.options.exclude_dns
)
########################################################
--
1.5.5.6
From 715c5549cfb83d5fc1796db69b4439ed689adbd7 Mon Sep 17 00:00:00 2001
From: Dave Hatton <dave(a)starground.it>
Date: Thu, 26 Mar 2009 23:28:03 +0000
Subject: [PATCH] added --exclude_dns option to buildiso
---
cobbler/action_buildiso.py | 8 ++++----
cobbler/api.py | 4 ++--
cobbler/modules/cli_misc.py | 4 +++-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/cobbler/action_buildiso.py b/cobbler/action_buildiso.py
index 2eebb66..bd5484f 100644
--- a/cobbler/action_buildiso.py
+++ b/cobbler/action_buildiso.py
@@ -83,7 +83,7 @@ class BuildIso:
return str(self.distctr)
- def generate_netboot_iso(self,imagesdir,isolinuxdir,profiles=None,systems=None):
+ def
generate_netboot_iso(self,imagesdir,isolinuxdir,profiles=None,systems=None,exclude_dns=None):
print _("- copying kernels and initrds - for profiles")
# copy all images in included profiles to images dir
for profile in self.api.profiles():
@@ -229,7 +229,7 @@ class BuildIso:
if data.has_key("gateway") and data["gateway"] !=
"":
append_line = append_line + " gateway=%s" %
data["gateway"]
- if data.has_key("name_servers") and
data["name_servers"]:
+ if not exclude_dns and data.has_key("name_servers") and
data["name_servers"]:
append_line = append_line + " dns=%s\n" %
",".join(data["name_servers"])
length=len(append_line)
@@ -329,7 +329,7 @@ class BuildIso:
return
- def
run(self,iso=None,tempdir=None,profiles=None,systems=None,distro=None,standalone=None,source=None):
+ def
run(self,iso=None,tempdir=None,profiles=None,systems=None,distro=None,standalone=None,source=None,exclude_dns=None):
# the distro option is for stand-alone builds only
if not standalone and distro is not None:
@@ -391,7 +391,7 @@ class BuildIso:
if standalone:
self.generate_standalone_iso(imagesdir,isolinuxdir,distro,source)
else:
- self.generate_netboot_iso(imagesdir,isolinuxdir,profiles,systems)
+
self.generate_netboot_iso(imagesdir,isolinuxdir,profiles,systems,exclude_dns)
cmd = "mkisofs -quiet -o %s -r -b isolinux/isolinux.bin -c
isolinux/boot.cat" % iso
cmd = cmd + " -no-emul-boot -boot-load-size 4"
diff --git a/cobbler/api.py b/cobbler/api.py
index 3d728d4..220e905 100644
--- a/cobbler/api.py
+++ b/cobbler/api.py
@@ -676,10 +676,10 @@ class BootAPI:
self.log("authorize",[user,resource,arg1,arg2,rc],debug=True)
return rc
- def
build_iso(self,iso=None,profiles=None,systems=None,tempdir=None,distro=None,standalone=None,source=None):
+ def
build_iso(self,iso=None,profiles=None,systems=None,tempdir=None,distro=None,standalone=None,source=None,
exclude_dns=None):
builder = action_buildiso.BuildIso(self._config)
return builder.run(
- iso=iso, profiles=profiles, systems=systems, tempdir=tempdir, distro=distro,
standalone=standalone, source=source
+ iso=iso, profiles=profiles, systems=systems, tempdir=tempdir, distro=distro,
standalone=standalone, source=source, exclude_dns=exclude_dns
)
def hardlink(self):
diff --git a/cobbler/modules/cli_misc.py b/cobbler/modules/cli_misc.py
index a4fc470..6050e48 100644
--- a/cobbler/modules/cli_misc.py
+++ b/cobbler/modules/cli_misc.py
@@ -243,6 +243,7 @@ class BuildIsoFunction(commands.CobblerFunction):
p.add_option("--distro", dest="distro",
help="(OPTIONAL) used with --standalone to create a distro-based ISO including all
associated profiles/systems")
p.add_option("--standalone", dest="standalone",
action="store_true", help="(OPTIONAL) creates a standalone ISO with all
required distro files on it")
p.add_option("--source", dest="source",
help="(OPTIONAL) used with --standalone to specify a source for the distribution
files")
+ p.add_option("--exclude_dns", dest="exclude_dns",
action="store_true", help="(OPTIONAL) prevents addition of name server
addresses to the kernel boot options")
def help_me(self):
return HELP_FORMAT % ("cobbler buildiso","[ARGS]")
@@ -258,7 +259,8 @@ class BuildIsoFunction(commands.CobblerFunction):
tempdir=self.options.tempdir,
distro=self.options.distro,
standalone=self.options.standalone,
- source=self.options.source
+ source=self.options.source,
+ exclude_dns=self.options.exclude_dns
)
########################################################
--
1.5.5.6