From 7ee964ea8bc64284409c7ac053eb0c12b449aed6 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Thu, 8 May 2008 13:41:07 -0400 Subject: Apply scott henson's replicate patch. --- AUTHORS | 1 + CHANGELOG | 1 + Makefile | 2 +- cobbler/api.py | 5 + cobbler/modules/cli_misc.py | 21 +++- cobbler/settings.py | 1 + cobbler/webui/master.py | 266 -------------------------------------------- 7 files changed, 29 insertions(+), 268 deletions(-) delete mode 100644 cobbler/webui/master.py diff --git a/AUTHORS b/AUTHORS index cb26afc..9230de5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -12,6 +12,7 @@ Patches and other contributions from: C. Daniel Chase Máirín Duffy John Eckersberg + Scott Henson Tru Huynh Matt Hyclak Pablo Iranzo Gómez diff --git a/CHANGELOG b/CHANGELOG index 278b8fa..eec038e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -37,6 +37,7 @@ Cobbler CHANGELOG - support for managing BIND - xen kernel (PV) distros do not get added to PXE menus as they won't boot there - cobbler buildiso command to build non live ISOs +- cobbler replicate command - ??? - 0.8.3 - Make createrepo get run for local cobbler reposync invocations as needed diff --git a/Makefile b/Makefile index 6287f5d..af01e9f 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,7 @@ messages: cobbler/*.py sed -i'~' -e 's/SOME DESCRIPTIVE TITLE/cobbler/g' -e 's/YEAR THE PACKAGE'"'"'S COPYRIGHT HOLDER/2007 Red Hat, Inc. /g' -e 's/FIRST AUTHOR , YEAR/Michael DeHaan , 2007/g' -e 's/PACKAGE VERSION/cobbler $(VERSION)-$(RELEASE)/g' -e 's/PACKAGE/cobbler/g' $(MESSAGESPOT) -rpms: clean manpage sdist +rpms: clean updatewui manpage sdist mkdir -p rpm-build cp dist/*.gz rpm-build/ rpmbuild --define "_topdir %(pwd)/rpm-build" \ diff --git a/cobbler/api.py b/cobbler/api.py index 20c7364..1b73acd 100644 --- a/cobbler/api.py +++ b/cobbler/api.py @@ -23,6 +23,7 @@ import action_reposync import action_status import action_validate import action_buildiso +import action_replicate from cexceptions import * import sub_process import module_loader @@ -437,3 +438,7 @@ class BootAPI: iso=iso, profiles=profiles, tempdir=tempdir ) + def replicate(self, cobbler_master = None): + replicator = action_replicate.Replicate(self._config) + return replicator.run(cobbler_master = cobbler_master) + diff --git a/cobbler/modules/cli_misc.py b/cobbler/modules/cli_misc.py index 6ca14a2..c72b11d 100644 --- a/cobbler/modules/cli_misc.py +++ b/cobbler/modules/cli_misc.py @@ -261,6 +261,24 @@ class BuildIsoFunction(commands.CobblerFunction): tempdir=self.options.tempdir ) +######################################################## + +class ReplicateFunction(commands.CobblerFunction): + + def help_me(self): + return HELP_FORMAT % ("cobbler replicate","[ARGS|--help]") + + def command_name(self): + return "replicate" + + def add_options(self, p, args): + p.add_option("--master", dest="master", help="Cobbler server to replicate from.") + + def run(self): + return self.api.replicate(cobbler_master = self.options.master) + + + ######################################################## # MODULE HOOKS @@ -275,7 +293,8 @@ def cli_functions(api): BuildIsoFunction(api), CheckFunction(api), ImportFunction(api), ReserializeFunction(api), ListFunction(api), ReportFunction(api), StatusFunction(api), - SyncFunction(api), RepoSyncFunction(api), ValidateKsFunction(api) + SyncFunction(api), RepoSyncFunction(api), ValidateKsFunction(api), + ReplicateFunction(api) ] return [] diff --git a/cobbler/settings.py b/cobbler/settings.py index bf12545..d147d4b 100644 --- a/cobbler/settings.py +++ b/cobbler/settings.py @@ -29,6 +29,7 @@ DEFAULTS = { "standard" : "/usr/lib/syslinux/pxelinux.0", "ia64" : "/var/lib/cobbler/elilo-3.6-ia64.efi" }, + "cobbler_master" : '', "default_kickstart" : "/etc/cobbler/default.ks", "default_virt_bridge" : "xenbr0", "default_virt_type" : "auto", diff --git a/cobbler/webui/master.py b/cobbler/webui/master.py deleted file mode 100644 index 50f9fd1..0000000 --- a/cobbler/webui/master.py +++ /dev/null @@ -1,266 +0,0 @@ -#!/usr/bin/env python - - - - -################################################## -## DEPENDENCIES -import sys -import os -import os.path -from os.path import getmtime, exists -import time -import types -import __builtin__ -from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion -from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple -from Cheetah.Template import Template -from Cheetah.DummyTransaction import DummyTransaction -from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList -from Cheetah.CacheRegion import CacheRegion -import Cheetah.Filters as Filters -import Cheetah.ErrorCatchers as ErrorCatchers - -################################################## -## MODULE CONSTANTS -try: - True, False -except NameError: - True, False = (1==1), (1==0) -VFFSL=valueFromFrameOrSearchList -VFSL=valueFromSearchList -VFN=valueForName -currentTime=time.time -__CHEETAH_version__ = '2.0.1' -__CHEETAH_versionTuple__ = (2, 0, 1, 'final', 0) -__CHEETAH_genTime__ = 1210208830.681746 -__CHEETAH_genTimestamp__ = 'Wed May 7 21:07:10 2008' -__CHEETAH_src__ = 'webui_templates/master.tmpl' -__CHEETAH_srcLastModified__ = 'Thu May 1 13:51:29 2008' -__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine' - -if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple: - raise AssertionError( - 'This template was compiled with Cheetah version' - ' %s. Templates compiled before version %s must be recompiled.'%( - __CHEETAH_version__, RequiredCheetahVersion)) - -################################################## -## CLASSES - -class master(Template): - - ################################################## - ## CHEETAH GENERATED METHODS - - - def __init__(self, *args, **KWs): - - Template.__init__(self, *args, **KWs) - if not self._CHEETAH__instanceInitialized: - cheetahKWArgs = {} - allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split() - for k,v in KWs.items(): - if k in allowedKWs: cheetahKWArgs[k] = v - self._initCheetahInstance(**cheetahKWArgs) - - - def body(self, **KWS): - - - - ## CHEETAH: generated from #block body at line 54, col 1. - trans = KWS.get("trans") - if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)): - trans = self.transaction # is None unless self.awake() was called - if not trans: - trans = DummyTransaction() - _dummyTrans = True - else: _dummyTrans = False - write = trans.response().write - SL = self._CHEETAH__searchList - _filter = self._CHEETAH__currentFilter - - ######################################## - ## START - generated method body - - write(''' -

Template Failure

- -''') - - ######################################## - ## END - generated method body - - return _dummyTrans and trans.response().getvalue() or "" - - - def respond(self, trans=None): - - - - ## CHEETAH: main method generated for this template - if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)): - trans = self.transaction # is None unless self.awake() was called - if not trans: - trans = DummyTransaction() - _dummyTrans = True - else: _dummyTrans = False - write = trans.response().write - SL = self._CHEETAH__searchList - _filter = self._CHEETAH__currentFilter - - ######################################## - ## START - generated method body - - write(''' - - - ''') - _v = VFFSL(SL,"title",True) # '$title' on line 5, col 12 - if _v is not None: write(_filter(_v, rawExpr='$title')) # from line 5, col 12. - write(''' - - - - - - - - - - - - -
-

- - Cobbler Logo - -

-
- -
- - - -
-''') - self.body(trans=trans) - write('''
-
- - - -''') - - ######################################## - ## END - generated method body - - return _dummyTrans and trans.response().getvalue() or "" - - ################################################## - ## CHEETAH GENERATED ATTRIBUTES - - - _CHEETAH__instanceInitialized = False - - _CHEETAH_version = __CHEETAH_version__ - - _CHEETAH_versionTuple = __CHEETAH_versionTuple__ - - _CHEETAH_genTime = __CHEETAH_genTime__ - - _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__ - - _CHEETAH_src = __CHEETAH_src__ - - _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__ - - title = "Cobbler Web Interface" - - _mainCheetahMethod_for_master= 'respond' - -## END CLASS DEFINITION - -if not hasattr(master, '_initCheetahAttributes'): - templateAPIClass = getattr(master, '_CHEETAH_templateClass', Template) - templateAPIClass._addCheetahPlumbingCodeToClass(master) - - -# CHEETAH was developed by Tavis Rudd and Mike Orr -# with code, advice and input from many other volunteers. -# For more information visit http://www.CheetahTemplate.org/ - -################################################## -## if run from command line: -if __name__ == '__main__': - from Cheetah.TemplateCmdLineIface import CmdLineIface - CmdLineIface(templateObj=master()).run() - - -- cgit