diff options
author | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-08-31 17:37:53 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-08-31 17:37:53 -0400 |
commit | 677f54d3bcdc58ccc2ebf87973c156bf2836ec9a (patch) | |
tree | 756be290a4f8d64550976cd34fa2538a88da8c87 | |
parent | 7b5da0bf400c2a09137c3fb7ff4d96f22750e612 (diff) | |
download | third_party-cobbler-677f54d3bcdc58ccc2ebf87973c156bf2836ec9a.tar.gz third_party-cobbler-677f54d3bcdc58ccc2ebf87973c156bf2836ec9a.tar.xz third_party-cobbler-677f54d3bcdc58ccc2ebf87973c156bf2836ec9a.zip |
Added "cobbler repo auto-add" feature which can discover all the repos
the cobbler server has configured in yum and set them up to be mirrored
automagically.
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | cobbler.spec | 9 | ||||
-rw-r--r-- | cobbler/api.py | 35 | ||||
-rwxr-xr-x | cobbler/cobbler.py | 22 | ||||
-rw-r--r-- | cobbler/collection.py | 3 | ||||
-rw-r--r-- | docs/cobbler.pod | 5 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | website/new/about.html | 10 |
8 files changed, 67 insertions, 22 deletions
@@ -1,6 +1,9 @@ Cobbler CHANGELOG (all entries mdehaan@redhat.com unless noted otherwise) +* Fri Aug 31 2007 - 0.6.2 +- cobbler repo auto-add to discover yum repos automatically + * Thu Aug 30 2007 - 0.6.1 - re enable --resolve in yumdownloader (cobbler repo mgmt feature) - fix get_distros_for_koan API function in cobblerd (not used by koan) diff --git a/cobbler.spec b/cobbler.spec index 01044ce..8c7ef16 100644 --- a/cobbler.spec +++ b/cobbler.spec @@ -1,8 +1,8 @@ %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Summary: Boot server configurator Name: cobbler -Version: 0.6.1 -Release: 2%{?dist} +Version: 0.6.2 +Release: 1%{?dist} Source0: %{name}-%{version}.tar.gz License: GPL Group: Applications/System @@ -142,7 +142,10 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT %changelog -* Tue Aug 30 2007 Michael DeHaan <mdehaan@redhat.com> - 0.6.1-2 +* Fri Aug 31 2007 Michael DeHaan <mdehaan@redhat.com> - 0.6.2-1 +- Upstream changes (see CHANGELOG) + +* Thu Aug 30 2007 Michael DeHaan <mdehaan@redhat.com> - 0.6.1-2 - Upstream changes (see CHANGELOG) * Thu Aug 09 2007 Michael DeHaan <mdehaan@redhat.com> - 0.6.0-1 diff --git a/cobbler/api.py b/cobbler/api.py index 6268283..6b22d30 100644 --- a/cobbler/api.py +++ b/cobbler/api.py @@ -121,6 +121,41 @@ class BootAPI: """ return self._config.new_repo(is_subobject=is_subobject) + def auto_add_repos(self): + """ + Import any repos this server knows about and mirror them. + Credit: Seth Vidal. + """ + try: + import yum + except: + raise CX(_("yum is not installed")) + + version = yum.__version__ + (a,b,c) = version.split(".") + version = a* 1000 + b*100 + c + if version < 324: + raise CX(_("need yum > 3.2.4 to proceed")) + + base = yum.YumBase() + base.doRepoSetup() + repos = base.repos.listEnabled() + if len(repos) == 0: + raise CX(_("no repos enabled/available -- giving up.")) + + for repo in repos: + url = repo.urls[0] + cobbler_repo = self.new_repo() + auto_name = repo.name.replace(" ","") + # FIXME: probably doesn't work for yum-rhn-plugin ATM + cobbler_repo.set_mirror(url) + cobbler_repo.set_name(auto_name) + print "auto adding: %s (%s)" % (auto_name, url) + self._config.repos().add(cobbler_repo,with_copy=True) + + print "run cobbler reposync to apply changes" + return True + def check(self): """ See if all preqs for network booting are valid. This returns diff --git a/cobbler/cobbler.py b/cobbler/cobbler.py index 0f34eee..4436a43 100755 --- a/cobbler/cobbler.py +++ b/cobbler/cobbler.py @@ -72,15 +72,16 @@ class BootCLI: 'report' : self.system_report } self.commands['repo'] = { - 'add' : self.repo_add, - 'edit' : self.repo_edit, - 'rename' : self.repo_rename, - 'copy' : self.repo_copy, - 'delete' : self.repo_remove, - 'remove' : self.repo_remove, - 'list' : self.repo_list, - 'report' : self.repo_report, - 'sync' : self.reposync + 'auto-add' : self.repo_auto_add, + 'add' : self.repo_add, + 'edit' : self.repo_edit, + 'rename' : self.repo_rename, + 'copy' : self.repo_copy, + 'delete' : self.repo_remove, + 'remove' : self.repo_remove, + 'list' : self.repo_list, + 'report' : self.repo_report, + 'sync' : self.reposync } self.commands['toplevel'] = { '-v' : self.version, @@ -414,6 +415,9 @@ class BootCLI: does_inherit = self.__prescan_for_inheritance_args(args) self.__generic_add(args,self.api.new_system,self.__system_control,does_inherit) + def repo_auto_add(self, args): + self.api.auto_add_repos() + def repo_add(self,args): does_inherit = self.__prescan_for_inheritance_args(args) self.__generic_add(args,self.api.new_repo,self.__repo_control,does_inherit) diff --git a/cobbler/collection.py b/cobbler/collection.py index 98e841c..576bf6f 100644 --- a/cobbler/collection.py +++ b/cobbler/collection.py @@ -23,6 +23,7 @@ import action_litesync import item_system import item_profile import item_distro +import item_repo from rhpl.translate import _, N_, textdomain, utf8 @@ -176,6 +177,8 @@ class Collection(serializable.Serializable): lite_sync.add_single_profile(ref.name) elif isinstance(ref, item_distro.Distro): lite_sync.add_single_distro(ref.name) + elif isinstance(ref, item_repo.Repo): + pass else: print _("Internal error. Object type not recognized: %s") % type(ref) diff --git a/docs/cobbler.pod b/docs/cobbler.pod index ba6758b..f786b4c 100644 --- a/docs/cobbler.pod +++ b/docs/cobbler.pod @@ -251,6 +251,11 @@ a fast local mirror. The mirror syntax for this is --mirror=rhn://channel-name have entitlements for this to work. This requires the cobbler server to be installed on RHEL5 or later. +Additionally, if you are running yum 3.2.4 or later, you can also automatically +tell cobbler to mirror any yum repository that the boot server itself is +configured to use. This command is "cobbler repo auto-add" and is also +somewhat experimental. + =item name This name is used as the save location for the mirror. If the mirror represented, say, Fedora Core @@ -4,7 +4,7 @@ import sys from distutils.core import setup, Extension import string -VERSION = "0.6.1" +VERSION = "0.6.2" SHORT_DESC = "Network Boot and Update Server" LONG_DESC = """ Cobbler is a network boot and update server. Cobbler supports PXE, provisioning virtualized images, and reinstalling existing Linux machines. The last two modes require a helper tool called 'koan' that integrates with cobbler. Cobbler's advanced features include importing distributions from DVDs and rsync mirrors, kickstart templating, integrated yum mirroring, and built-in DHCP Management. Cobbler has a Python API for integration with other GPL systems management applications. diff --git a/website/new/about.html b/website/new/about.html index 12a7d57..4990e39 100644 --- a/website/new/about.html +++ b/website/new/about.html @@ -1,14 +1,6 @@ <h2>About Cobbler</h2> -<!-- -<h3>Provisioning For Everyone</h3> ---> - -<!-- -<a href="img/screenshot_full.png"><img src="img/screenshot.png" style="float: left; margin-right: 10px;" /></a> ---> - -<p>Cobbler is a Linux provisioning tool that allows for rapid setup of network installation environments. With a simple series of commands, network installs can be configured for PXE, reinstallations, and virtualized installs. Cobbler uses a helper program called 'Koan' (which interacts with Cobbler) for reinstallation and virtualization support.</p> +<p>Cobbler is a Linux boot server that allows for rapid setup of network installation environments. With a simple series of commands, network installs can be configured for PXE, reinstallations, and virtualized installs using Xen or KVM. Cobbler uses a helper program called 'Koan' (which interacts with Cobbler) for reinstallation and virtualization support.</p> <p>Setting up Cobbler is simple. Installation trees can be <A HREF="./cobbler-import.php">imported</A> directly from media you already have (or copied from a mirror location), and turned into network install sources within minutes. RHEL, Fedora, and Centos are all supported for both the boot server and installation targets.</p> |