summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-11-01 18:03:25 -0400
committerMichael DeHaan <mdehaan@redhat.com>2007-11-01 18:03:25 -0400
commit7075e26adcb4f185931930c2b9489502501e12ee (patch)
tree8edee6e1e788fc083cd485716c053282146d4d05
parent95e5a65993da2d0b008222501c6a132bb8a3daa2 (diff)
downloadthird_party-cobbler-7075e26adcb4f185931930c2b9489502501e12ee.tar.gz
third_party-cobbler-7075e26adcb4f185931930c2b9489502501e12ee.tar.xz
third_party-cobbler-7075e26adcb4f185931930c2b9489502501e12ee.zip
Code to wire up the new --server-override to the sync code. This leaves off some of the
repo management, which will not work with --server-override completely in all cases (depending on DNS) until we do some extra post magic in our action_sync stanza generaton. Ow, my brain hurts just thinking about other people who have to read that explanation :)
-rw-r--r--cobbler/action_reposync.py9
-rw-r--r--cobbler/action_sync.py33
-rw-r--r--cobbler/utils.py2
3 files changed, 27 insertions, 17 deletions
diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py
index 7fac220..8cd738f 100644
--- a/cobbler/action_reposync.py
+++ b/cobbler/action_reposync.py
@@ -224,6 +224,13 @@ class RepoSync:
(A) Create local files that can be used with yum on provisioned clients to make use of thisi mirror.
(B) Create a temporary file for yum to feed into reposync
"""
+
+ # FIXME: the output case will generate repo configuration files which are usable
+ # for the installed systems. They need to be made compatible with --server-override
+ # which means that we should NOT replace @@server@@ except in a dynamically generated
+ # post script that runs on each file we wget, and replace it there. Until then
+ # installed repos may require a host file setting that allows them to find the
+ # main server address used for the initial mirroring. We can clean this up :)
if output:
fname = os.path.join(dest_path,"config.repo")
@@ -234,6 +241,8 @@ class RepoSync:
config_file.write("[%s]\n" % repo.name)
config_file.write("name=%s\n" % repo.name)
if output:
+ # see note above: leave as @@server@@ and fix in %post of kickstart when
+ # we generate the stanza
line = "baseurl=http://%s/cobbler/repo_mirror/%s\n" % (self.settings.server, repo.name)
config_file.write(line)
else:
diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py
index 4d07881..75e5389 100644
--- a/cobbler/action_sync.py
+++ b/cobbler/action_sync.py
@@ -169,8 +169,6 @@ class BootSync:
systxt = systxt + " hardware ethernet %s;\n" % mac
if ip is not None and ip != "":
systxt = systxt + " fixed-address %s;\n" % ip
- # not needed, as it's in the template.
- # systxt = systxt + " next-server %s;\n" % self.settings.next_server
systxt = systxt + "}\n"
else:
@@ -399,16 +397,16 @@ class BootSync:
buf = ""
if system is not None:
- buf = buf + pattern1 % (self.settings.server, "system", "done", system.name)
+ buf = buf + pattern1 % (blended["server"], "system", "done", system.name)
if str(self.settings.pxe_just_once).upper() in [ "1", "Y", "YES", "TRUE" ]:
- buf = buf + "\n" + pattern2 % (self.settings.server, system.name)
+ buf = buf + "\n" + pattern2 % (blended["server"], system.name)
if kickstart and os.path.exists(kickstart):
- buf = buf + "\n" + pattern3 % (self.settings.server, "kickstarts_sys", system.name)
+ buf = buf + "\n" + pattern3 % (blended["server"], "kickstarts_sys", system.name)
else:
- buf = buf + pattern1 % (self.settings.server, "profile", "done", profile.name)
+ buf = buf + pattern1 % (blended["server"], "profile", "done", profile.name)
if kickstart and os.path.exists(kickstart):
- buf = buf + "\n" + pattern3 % (self.settings.server, "kickstarts", profile.name)
+ buf = buf + "\n" + pattern3 % (blended["server"], "kickstarts", profile.name)
return buf
@@ -417,12 +415,13 @@ class BootSync:
# the list of repos to things that Anaconda can install from. This corresponds
# will replace "TEMPLATE::yum_repo_stanza" in a cobbler kickstart file.
buf = ""
- repos = utils.blender(self.api, False, profile)["repos"]
+ blended = utils.blender(self.api, False, profile)
+ repos = blended["repos"]
for r in repos:
repo = self.repos.find(name=r)
if repo is None:
continue
- http_url = "http://%s/cblr/repo_mirror/%s" % (self.settings.server, repo.name)
+ http_url = "http://%s/cblr/repo_mirror/%s" % (blended["server"], repo.name)
buf = buf + "repo --name=%s --baseurl=%s\n" % (repo.name, http_url)
distro = profile.get_conceptual_parent()
@@ -438,7 +437,8 @@ class BootSync:
def generate_config_stanza(self, profile):
# returns the line in post that would configure yum to use repos added with "cobbler repo add"
- repos = utils.blender(self.api, False,profile)["repos"]
+ blended = utils.blender(self.api, False,profile)
+ repos = blended["repos"]
buf = ""
for r in repos:
repo = self.repos.find(name=r)
@@ -446,7 +446,7 @@ class BootSync:
continue
repo.local_filename = repo.local_filename.replace(".repo","")
if not (repo.local_filename is None) and not (repo.local_filename == ""):
- buf = buf + "wget http://%s/cblr/repo_mirror/%s/config.repo --output-document=/etc/yum.repos.d/%s.repo\n" % (self.settings.server, repo.name, repo.local_filename)
+ buf = buf + "wget http://%s/cblr/repo_mirror/%s/config.repo --output-document=/etc/yum.repos.d/%s.repo\n" % (blended["server"], repo.name, repo.local_filename)
# now install the core repos
distro = profile.get_conceptual_parent()
@@ -739,9 +739,10 @@ class BootSync:
# now build the kernel command line
if system is not None:
- kopts = utils.blender(self.api, True,system)["kernel_options"]
+ blended = utils.blender(self.api, True,system)
else:
- kopts = utils.blender(self.api, True,profile)["kernel_options"]
+ blended = utils.blender(self.api, True,profile)
+ kopts = blended["kernel_options"]
# ---
# generate the append line
@@ -756,9 +757,9 @@ class BootSync:
if kickstart_path is not None and kickstart_path != "":
if system is not None and kickstart_path.startswith("/"):
- kickstart_path = "http://%s/cblr/kickstarts_sys/%s/ks.cfg" % (self.settings.server, system.name)
+ kickstart_path = "http://%s/cblr/kickstarts_sys/%s/ks.cfg" % (blended["server"], system.name)
elif kickstart_path.startswith("/") or kickstart_path.find("/cobbler/kickstarts/") != -1:
- kickstart_path = "http://%s/cblr/kickstarts/%s/ks.cfg" % (self.settings.server, profile.name)
+ kickstart_path = "http://%s/cblr/kickstarts/%s/ks.cfg" % (blended["server"], profile.name)
if distro.breed is None or distro.breed == "redhat":
append_line = "%s ks=%s" % (append_line, kickstart_path)
@@ -832,7 +833,7 @@ class BootSync:
fd = open(filename, "w+")
if blended.has_key("kickstart") and blended["kickstart"].startswith("/"):
# write the file location as needed by koan
- blended["kickstart"] = "http://%s/cblr/kickstarts/%s/ks.cfg" % (self.settings.server, profile.name)
+ blended["kickstart"] = "http://%s/cblr/kickstarts/%s/ks.cfg" % (blended["server"], profile.name)
fd.write(yaml.dump(blended))
fd.close()
diff --git a/cobbler/utils.py b/cobbler/utils.py
index 113d9dd..4f63651 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -288,7 +288,7 @@ def blender(api_handle,remove_hashes, root_obj):
if settings.syslog_port != 0:
if not results.has_key("kernel_options"):
results["kernel_options"] = {}
- syslog = "%s:%s" % (settings.server, settings.syslog_port)
+ syslog = "%s:%s" % (results["server"], settings.syslog_port)
results["kernel_options"]["syslog"] = syslog
# determine if we have room to add kssendmac to the kernel options line