summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-11-29 17:38:22 -0500
committerMichael DeHaan <mdehaan@redhat.com>2007-11-29 17:38:22 -0500
commit248b28b0181d87069364a87f4762086206781d38 (patch)
treee6754d158c64db4447e810299e019ada481504b6
parent4547a2759ce5369774676f16365492f14aad2392 (diff)
downloadthird_party-cobbler-248b28b0181d87069364a87f4762086206781d38.tar.gz
third_party-cobbler-248b28b0181d87069364a87f4762086206781d38.tar.xz
third_party-cobbler-248b28b0181d87069364a87f4762086206781d38.zip
Apply Christophe's patch to enable yum priorities. Slightly tweaked to default to 99, not 200.
-rw-r--r--AUTHORS1
-rw-r--r--cobbler/action_import.py2
-rw-r--r--cobbler/action_reposync.py3
-rw-r--r--cobbler/api.py2
-rw-r--r--cobbler/item_repo.py17
-rw-r--r--cobbler/modules/cli_repo.py2
-rw-r--r--cobbler/webui/CobblerWeb.py3
-rw-r--r--cobbler/webui/master.py4
-rw-r--r--docs/cobbler.pod6
-rw-r--r--webui_templates/repo_edit.tmpl15
10 files changed, 48 insertions, 7 deletions
diff --git a/AUTHORS b/AUTHORS
index b35f672..0f9d456 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -20,6 +20,7 @@ Patches and other contributions from:
Jack Neely <jjneely@ncsu.edu>
Ben Riggs <rigg0022@umn.edu>
Adam Rosenwald <thestrider@gmail.com>
+ Christophe Sahut <csahut@nogoa.org>
Scott Seago <sseago@redhat.com>
Al Tobey <tobert@gmail.com>
Tim Verhoeven <tim.verhoeven.be@gmail.com>
diff --git a/cobbler/action_import.py b/cobbler/action_import.py
index 6c398c7..d2f2d05 100644
--- a/cobbler/action_import.py
+++ b/cobbler/action_import.py
@@ -431,6 +431,8 @@ class Importer:
config_file.write("baseurl=http://@@server@@/cobbler/ks_mirror/%s\n" % (urlseg))
config_file.write("enabled=1\n")
config_file.write("gpgcheck=0\n")
+ # NOTE: yum priority defaults to 99 if that plugin is enabled
+ # so don't need to add priority=99 here
config_file.close()
# don't run creatrepo twice -- this can happen easily for Xen and PXE, when
diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py
index e67317a..27491fa 100644
--- a/cobbler/action_reposync.py
+++ b/cobbler/action_reposync.py
@@ -235,8 +235,6 @@ 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://${server}/cobbler/repo_mirror/%s\n" % (repo.name)
config_file.write(line)
else:
@@ -244,6 +242,7 @@ class RepoSync:
line = line.replace("@@server@@",self.settings.server)
config_file.write(line)
config_file.write("enabled=1\n")
+ config_file.write("priority=%s\n" % repo.priority)
config_file.write("gpgcheck=0\n")
config_file.close()
return fname
diff --git a/cobbler/api.py b/cobbler/api.py
index 1a26385..50ad244 100644
--- a/cobbler/api.py
+++ b/cobbler/api.py
@@ -189,7 +189,7 @@ class BootAPI:
sync = action_sync.BootSync(self._config)
return sync.run()
- def reposync(self, name):
+ def reposync(self, name=None):
"""
Take the contents of /var/lib/cobbler/repos and update them --
or create the initial copy if no contents exist yet.
diff --git a/cobbler/item_repo.py b/cobbler/item_repo.py
index 06d855f..659e3a8 100644
--- a/cobbler/item_repo.py
+++ b/cobbler/item_repo.py
@@ -33,6 +33,7 @@ class Repo(item.Item):
self.name = None
self.mirror = (None, '<<inherit>>')[is_subobject]
self.keep_updated = ('y', '<<inherit>>')[is_subobject]
+ self.priority = (99, '<<inherit>>')[is_subobject]
self.rpm_list = ("", '<<inherit>>')[is_subobject]
self.createrepo_flags = ("-c cache", '<<inherit>>')[is_subobject]
self.depth = 2 # arbitrary, as not really apart of the graph
@@ -43,6 +44,7 @@ class Repo(item.Item):
self.name = self.load_item(seed_data, 'name')
self.mirror = self.load_item(seed_data, 'mirror')
self.keep_updated = self.load_item(seed_data, 'keep_updated','y')
+ self.priority = self.load_item(seed_data, 'priority',99)
self.rpm_list = self.load_item(seed_data, 'rpm_list')
self.createrepo_flags = self.load_item(seed_data, 'createrepo_flags', '-c cache')
self.arch = self.load_item(seed_data, 'arch')
@@ -81,6 +83,18 @@ class Repo(item.Item):
self.keep_updated = False
return True
+ def set_priority(self,priority):
+ """
+ Set the priority of the repository. 1= highest, 99=default
+ Only works if host is using priorities plugin for yum.
+ """
+ try:
+ priority = int(str(priority))
+ except:
+ raise CX(_("invalid priority level: %s") % priority)
+ self.priority = priority
+ return True
+
def set_rpm_list(self,rpms):
"""
Rather than mirroring the entire contents of a repository (Fedora Extras, for instance,
@@ -135,6 +149,7 @@ class Repo(item.Item):
'name' : self.name,
'mirror' : self.mirror,
'keep_updated' : self.keep_updated,
+ 'priority' : self.priority,
'rpm_list' : self.rpm_list,
'createrepo_flags' : self.createrepo_flags,
'arch' : self.arch,
@@ -146,6 +161,7 @@ class Repo(item.Item):
buf = _("repo : %s\n") % self.name
buf = buf + _("mirror : %s\n") % self.mirror
buf = buf + _("keep updated : %s\n") % self.keep_updated
+ buf = buf + _("priority : %s\n") % self.priority
buf = buf + _("rpm list : %s\n") % self.rpm_list
buf = buf + _("createrepo_flags : %s\n") % self.createrepo_flags
buf = buf + _("arch : %s\n") % self.arch
@@ -175,6 +191,7 @@ class Repo(item.Item):
'mirror-name' : self.set_name,
'mirror' : self.set_mirror,
'keep-updated' : self.set_keep_updated,
+ 'priority' : self.set_priority,
'rpm-list' : self.set_rpm_list,
'createrepo-flags' : self.set_createrepo_flags
}
diff --git a/cobbler/modules/cli_repo.py b/cobbler/modules/cli_repo.py
index f1c61b3..88de685 100644
--- a/cobbler/modules/cli_repo.py
+++ b/cobbler/modules/cli_repo.py
@@ -43,6 +43,7 @@ class RepoFunction(commands.CobblerFunction):
p.add_option("--createrepo-flags", dest="createrepo_flags", help="additional flags for createrepo")
p.add_option("--rpm-list", dest="rpm_list", help="just mirror these rpms")
p.add_option("--keep-updated", dest="keep_updated", help="update on each reposync, yes/no")
+ p.add_option("--priority", dest="priority", help="set priority")
p.add_option("--mirror", dest="mirror", help="source to mirror (REQUIRED)")
p.add_option("--name", dest="name", help="ex: 'Fedora-8-updates-i386' (REQUIRED)")
@@ -61,6 +62,7 @@ class RepoFunction(commands.CobblerFunction):
if self.options.createrepo_flags: obj.set_createrepo_flags(self.options.createrepo_flags)
if self.options.rpm_list: obj.set_rpm_list(self.options.rpm_list)
if self.options.keep_updated: obj.set_keep_updated(self.options.keep_updated)
+ if self.options.priority: obj.set_priority(self.options.priority)
if self.options.mirror: obj.set_mirror(self.options.mirror)
return self.object_manipulator_finish(obj, self.api.repos)
diff --git a/cobbler/webui/CobblerWeb.py b/cobbler/webui/CobblerWeb.py
index ac3b732..6cdf7c0 100644
--- a/cobbler/webui/CobblerWeb.py
+++ b/cobbler/webui/CobblerWeb.py
@@ -641,7 +641,7 @@ class CobblerWeb(object):
} )
def repo_save(self,name=None,oldname=None,new_or_edit=None,editmode="edit",
- mirror=None,keep_updated=None,
+ mirror=None,keep_updated=None,priority=200,
rpm_list=None,createrepo_flags=None,arch=None,delete1=None,delete2=None,**args):
if not self.__xmlrpc_setup():
return self.xmlrpc_auth_failure()
@@ -679,6 +679,7 @@ class CobblerWeb(object):
self.remote.modify_repo(repo, 'name', name, self.token)
self.remote.modify_repo(repo, 'mirror', mirror, self.token)
self.remote.modify_repo(repo, 'keep-updated', keep_updated, self.token)
+ self.remote.modify_repo(repo, 'priority', priority, self.token)
if rpm_list:
self.remote.modify_repo(repo, 'rpm-list', rpm_list, self.token)
diff --git a/cobbler/webui/master.py b/cobbler/webui/master.py
index 5d630c6..356fceb 100644
--- a/cobbler/webui/master.py
+++ b/cobbler/webui/master.py
@@ -33,8 +33,8 @@ VFN=valueForName
currentTime=time.time
__CHEETAH_version__ = '2.0'
__CHEETAH_versionTuple__ = (2, 0, 0, 'final', 0)
-__CHEETAH_genTime__ = 1196370730.2521651
-__CHEETAH_genTimestamp__ = 'Thu Nov 29 16:12:10 2007'
+__CHEETAH_genTime__ = 1196374123.089437
+__CHEETAH_genTimestamp__ = 'Thu Nov 29 17:08:43 2007'
__CHEETAH_src__ = 'webui_templates/master.tmpl'
__CHEETAH_srcLastModified__ = 'Wed Nov 7 12:24:52 2007'
__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
diff --git a/docs/cobbler.pod b/docs/cobbler.pod
index 787e539..4200f29 100644
--- a/docs/cobbler.pod
+++ b/docs/cobbler.pod
@@ -276,7 +276,7 @@ on your network will result in faster, more up-to-date installations and faster
are only provisioning a home setup, this will probably be overkill, though it can be very useful
for larger setups (labs, datacenters, etc).
-B<cobbler repo add --mirror=url --name=string [--rpmlist=list] [--creatrepo-flags=string] [--keep-updated=Y/N] [--arch=string]>
+B<cobbler repo add --mirror=url --name=string [--rpmlist=list] [--creatrepo-flags=string] [--keep-updated=Y/N] [--priority=number][--arch=string]>
=over
@@ -342,6 +342,10 @@ Specifies optional flags to feed into the createrepo tool, which is called when
Specifies that the named repository should not be updated during a normal "cobbler reposync". The repo may still be updated by name. See "cobbler reposync" below.
+=item priority
+
+Specifies the priority of the repository (the lower the number, the higher the priority), which applies to installed machines using the repositories that also have the yum priorities plugin installed. The default priority for the plugin is 99, as is that of all cobbler mirrored repositories.
+
=item arch
Specifies what architecture the repository should use. By default the current system arch (of the server) is used, which may not be desirable. Using this to override the default arch allows mirroring of source repositories (using --arch=src).
diff --git a/webui_templates/repo_edit.tmpl b/webui_templates/repo_edit.tmpl
index eed9db1..6fb5c72 100644
--- a/webui_templates/repo_edit.tmpl
+++ b/webui_templates/repo_edit.tmpl
@@ -90,6 +90,21 @@ function disablename(value)
<br/>
+ <tr>
+ <td>
+ <label for="priority">Priority</label>
+ </td>
+ <td>
+ <input type="text" size="512" style="width: 150px;" name="priority" id="priority"
+ #if $repo
+ value="$repo.priority"
+ #end if
+ />
+ <p class="context-tip">Repo priority, if using yum priorities plugin of target (99=default) </p>
+ </td>
+ </tr>
+ <br/>
+
## FIXME: input field sizes should be larger (universally)
## FIXME: make this a text area?