summaryrefslogtreecommitdiffstats
path: root/cobbler
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-09-06 12:45:27 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-09-06 12:45:27 -0400
commita72c34cae409841956d97b22e9102f723cb66d8e (patch)
treebd171967fec8e2b0a2b4174c60f03dd918da4838 /cobbler
parent36c7abaa74b11786cd5f3184c17938b516baf890 (diff)
downloadthird_party-cobbler-a72c34cae409841956d97b22e9102f723cb66d8e.tar.gz
third_party-cobbler-a72c34cae409841956d97b22e9102f723cb66d8e.tar.xz
third_party-cobbler-a72c34cae409841956d97b22e9102f723cb66d8e.zip
Ben Riggs patch to allow for reposyncs of explicit repos + tweak
to repo object to ensure items get serialized as booleans.
Diffstat (limited to 'cobbler')
-rw-r--r--cobbler/action_reposync.py38
-rw-r--r--cobbler/api.py4
-rwxr-xr-xcobbler/cobbler.py2
-rw-r--r--cobbler/item_repo.py9
4 files changed, 29 insertions, 24 deletions
diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py
index 8c7e242..ac2cff8 100644
--- a/cobbler/action_reposync.py
+++ b/cobbler/action_reposync.py
@@ -38,25 +38,33 @@ class RepoSync:
"""
Constructor
"""
- self.verbose = True
- self.config = config
- self.distros = config.distros()
- self.profiles = config.profiles()
- self.systems = config.systems()
- self.settings = config.settings()
- self.repos = config.repos()
+ self.verbose = True
+ self.config = config
+ self.distros = config.distros()
+ self.profiles = config.profiles()
+ self.systems = config.systems()
+ self.settings = config.settings()
+ self.repos = config.repos()
- # ==================================================================================
- def run(self,verbose=True):
+ # ===================================================================
+
+ def run(self, args=[], verbose=True):
"""
Syncs the current repo configuration file with the filesystem.
"""
self.verbose = verbose
for repo in self.repos:
+ if args != [] and repo.name not in args:
+ continue
+ elif args == [] and not repo.keep_updated:
+ print _("- %s is set to not be updated") % repo.name
+ continue
+
repo_path = os.path.join(self.settings.webdir, "repo_mirror", repo.name)
mirror = repo.mirror
+
if not os.path.isdir(repo_path) and not repo.mirror.lower().startswith("rhn://"):
os.makedirs(repo_path)
@@ -67,7 +75,7 @@ class RepoSync:
return True
- # ==================================================================================
+ # ==================================================================
def do_reposync(self,repo):
@@ -92,13 +100,6 @@ class RepoSync:
if repo.rpm_list != "":
has_rpm_list = True
- # user might have disabled repo updates in the config file for whatever reason.
- # if so, don't update this one.
-
- if not repo.keep_updated:
- print _("- %s is set to not be updated") % repo.name
- return True
-
# create yum config file for use by reposync
store_path = os.path.join(self.settings.webdir, "repo_mirror")
dest_path = os.path.join(store_path, repo.name)
@@ -188,9 +189,6 @@ class RepoSync:
Handle copying of rsync:// and rsync-over-ssh repos.
"""
- if not repo.keep_updated:
- print _("- %s is set to not be updated") % repo.name
- return True
if repo.rpm_list != "":
print _("- warning: --rpm-list is not supported for rsync'd repositories")
dest_path = os.path.join(self.settings.webdir, "repo_mirror", repo.name)
diff --git a/cobbler/api.py b/cobbler/api.py
index 1c9a445..c1063b5 100644
--- a/cobbler/api.py
+++ b/cobbler/api.py
@@ -189,13 +189,13 @@ class BootAPI:
sync = action_sync.BootSync(self._config)
return sync.run()
- def reposync(self):
+ def reposync(self, args=[]):
"""
Take the contents of /var/lib/cobbler/repos and update them --
or create the initial copy if no contents exist yet.
"""
reposync = action_reposync.RepoSync(self._config)
- return reposync.run()
+ return reposync.run(args)
def status(self,mode):
statusifier = action_status.BootStatusReport(self._config, mode)
diff --git a/cobbler/cobbler.py b/cobbler/cobbler.py
index aeb8962..c982d76 100755
--- a/cobbler/cobbler.py
+++ b/cobbler/cobbler.py
@@ -581,7 +581,7 @@ class BootCLI:
Sync the repo-specific portions of the config with the filesystem.
'cobbler reposync'. Intended to be run on cron.
"""
- self.api.reposync()
+ self.api.reposync(args)
return True
def validateks(self,args):
diff --git a/cobbler/item_repo.py b/cobbler/item_repo.py
index 447e057..c335eaa 100644
--- a/cobbler/item_repo.py
+++ b/cobbler/item_repo.py
@@ -47,6 +47,10 @@ class Repo(item.Item):
self.rpm_list = self.load_item(seed_data, 'rpm_list')
self.createrepo_flags = self.load_item(seed_data, 'createrepo_flags', '-c cache')
self.depth = self.load_item(seed_data, 'depth', 2)
+
+ # force this to be saved as a boolean
+ self.set_keep_updated(self.keep_updated)
+
return self
def set_name(self,name):
@@ -69,7 +73,10 @@ class Repo(item.Item):
"""
This allows the user to disable updates to a particular repo for whatever reason.
"""
- if not keep_updated.lower() in ["yes","y","yup","yeah","1"]:
+ if type(keep_updated) == bool:
+ self.keep_updated = keep_updated
+ return True
+ if not keep_updated.lower() in ["yes","y","yup","yeah","1","true"]:
self.keep_updated = False
else:
self.keep_updated = True