summaryrefslogtreecommitdiffstats
path: root/cobbler/action_reposync.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2006-12-13 16:51:08 -0500
committerJim Meyering <jim@meyering.net>2006-12-13 16:51:08 -0500
commit3e56da3ca7a1a856e64ba8039d9617582852f14a (patch)
tree6eaea37a16064cee0762ef8feb6d8d483a9f77c9 /cobbler/action_reposync.py
parentb7eabac3549b70fb5ce22b69b79b400affa98690 (diff)
downloadthird_party-cobbler-3e56da3ca7a1a856e64ba8039d9617582852f14a.tar.gz
third_party-cobbler-3e56da3ca7a1a856e64ba8039d9617582852f14a.tar.xz
third_party-cobbler-3e56da3ca7a1a856e64ba8039d9617582852f14a.zip
Adding createrepo calls to "cobbler reposync" ... working on auto-generating yum configs
and allowing them to be installable for mirrored repos.
Diffstat (limited to 'cobbler/action_reposync.py')
-rw-r--r--cobbler/action_reposync.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py
index 8089900..f067aee 100644
--- a/cobbler/action_reposync.py
+++ b/cobbler/action_reposync.py
@@ -27,8 +27,6 @@ import cexceptions
import traceback
import errno
-
-
class RepoSync:
"""
Handles conversion of internal state to the tftpboot tree layout
@@ -79,8 +77,22 @@ class RepoSync:
spacer = ""
if repo.mirror.find("ssh://") != -1:
spacer = "-e ssh"
- cmd = "rsync -av %s --exclude=debug/ %s %s" % (spacer, repo.mirror, dest_path)
+ cmd = "rsync -av %s --delete --delete-excluded --exclude-from=/etc/cobbler/rsync.exclude %s %s" % (spacer, repo.mirror, dest_path)
print "executing: %s" % cmd
rc = sub_process.call(cmd, shell=True)
-
+ arg = {}
+ print "- walking: %s" % dest_path
+ os.path.walk(dest_path, self.createrepo_walker, arg)
+ def createrepo_walker(self, arg, dirname, fname):
+ target_dir = os.path.dirname(dirname).split("/")[-1]
+ print "- scanning: %s" % target_dir
+ if target_dir.lower() in [ "i386", "x86_64", "ia64" ]:
+ try:
+ cmd = "createrepo %s" % dirname
+ print cmd
+ sub_process.call(cmd, shell=True)
+ except:
+ print "- createrepo failed. Is it installed?"
+ fnames = [] # we're in the right place
+