"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cobbler/collection_repos.py" between
cobbler-2.8.4.tar.gz and cobbler-3.0.0.tar.gz

About: cobbler is a Linux installation and deployment server that allows for rapid setup of network installation environments. It can help with installation, DNS, DHCP, package updates, power management, configuration management orchestration, and much more.

collection_repos.py  (cobbler-2.8.4):collection_repos.py  (cobbler-3.0.0)
""" """
Repositories in cobbler are way to create a local mirror of a yum repository.
When used in conjunction with a mirrored kickstart tree (see "cobbler import")
outside bandwidth needs can be reduced and/or eliminated.
Copyright 2006-2009, Red Hat, Inc and Others Copyright 2006-2009, Red Hat, Inc and Others
Michael DeHaan <michael.dehaan AT gmail> Michael DeHaan <michael.dehaan AT gmail>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA 02110-1301 USA
""" """
import item_repo as repo
import utils
import collection
from cexceptions import CX
from utils import _
import os.path import os.path
TESTMODE = False from cobbler import collection
from cobbler import item_repo as repo
#-------------------------------------------- from cobbler import utils
from cobbler.cexceptions import CX
from cobbler.utils import _
class Repos(collection.Collection): class Repos(collection.Collection):
"""
Repositories in cobbler are way to create a local mirror of a yum repository
.
When used in conjunction with a mirrored distro tree (see "cobbler import"),
outside bandwidth needs can be reduced and/or eliminated.
"""
def collection_type(self): def collection_type(self):
return "repo" return "repo"
def factory_produce(self,config,seed_data): def factory_produce(self, config, item_dict):
""" """
Return a Distro forged from seed_data Return a Distro forged from item_dict
""" """
return repo.Repo(config).from_datastruct(seed_data) new_repo = repo.Repo(config)
new_repo.from_dict(item_dict)
return new_repo
def remove(self,name,with_delete=True,with_sync=True,with_triggers=True,recu rsive=False,logger=None): def remove(self, name, with_delete=True, with_sync=True, with_triggers=True, recursive=False, logger=None):
""" """
Remove element named 'name' from the collection Remove element named 'name' from the collection
""" """
# NOTE: with_delete isn't currently meaningful for repos # NOTE: with_delete isn't currently meaningful for repos
# but is left in for consistancy in the API. Unused. # but is left in for consistancy in the API. Unused.
name = name.lower() name = name.lower()
obj = self.find(name=name) obj = self.find(name=name)
if obj is not None: if obj is not None:
if with_delete: if with_delete:
if with_triggers: if with_triggers:
utils.run_triggers(self.config.api, obj, "/var/lib/cobbler/t riggers/delete/repo/pre/*", [], logger) utils.run_triggers(self.collection_mgr.api, obj, "/var/lib/c obbler/triggers/delete/repo/pre/*", [], logger)
self.lock.acquire() self.lock.acquire()
try: try:
del self.listing[name] del self.listing[name]
finally: finally:
self.lock.release() self.lock.release()
self.config.serialize_delete(self, obj) self.collection_mgr.serialize_delete(self, obj)
if with_delete: if with_delete:
if with_triggers: if with_triggers:
utils.run_triggers(self.config.api, obj, "/var/lib/cobbler/t utils.run_triggers(self.collection_mgr.api, obj, "/var/lib/c
riggers/delete/repo/post/*", [], logger) obbler/triggers/delete/repo/post/*", [], logger)
utils.run_triggers(self.config.api, obj, "/var/lib/cobbler/t utils.run_triggers(self.collection_mgr.api, obj, "/var/lib/c
riggers/change/*", [], logger) obbler/triggers/change/*", [], logger)
#FIXME: better use config.settings() webdir? # FIXME: better use config.settings() webdir?
path = "/var/www/cobbler/repo_mirror/%s" % obj.name path = "/var/www/cobbler/repo_mirror/%s" % obj.name
if os.path.exists("/srv/www/"): if os.path.exists("/srv/www/"):
path = "/srv/www/cobbler/repo_mirror/%s" % obj.name path = "/srv/www/cobbler/repo_mirror/%s" % obj.name
if os.path.exists(path): if os.path.exists(path):
utils.rmtree(path) utils.rmtree(path)
return True return
raise CX(_("cannot delete an object that does not exist: %s") % name) raise CX(_("cannot delete an object that does not exist: %s") % name)
# EOF
 End of changes. 15 change blocks. 
25 lines changed or deleted 25 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)