[PATCH] 'cobbler reposync foo' now updates repo 'foo' whether marked to keep updated or not.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 cobbler/action_reposync.py |   35 +++++++++++++++++------------------
 cobbler/api.py             |    4 ++--
 cobbler/cobbler.py         |    2 +-
 3 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py
index 8c7e242..c8446c5 100644
--- a/cobbler/action_reposync.py
+++ b/cobbler/action_reposync.py
@@ -38,25 +38,34 @@ 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)
             
@@ -92,13 +101,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 +190,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 f5d3322..304eddb 100644
--- a/cobbler/api.py
+++ b/cobbler/api.py
@@ -188,13 +188,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 7ecb2d6..9d166e3 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):
-- 
1.5.2.4


--------------000401020305000101040708--

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux