In rsync make src and dest labels configurable
authorNikos Skalkotos <skalkoto@grnet.gr>
Fri, 4 Jan 2013 11:17:24 +0000 (13:17 +0200)
committerNikos Skalkotos <skalkoto@grnet.gr>
Fri, 4 Jan 2013 11:17:24 +0000 (13:17 +0200)
image_creator/bundle_volume.py
image_creator/rsync.py

index ff4861e..e86d613 100644 (file)
@@ -385,7 +385,7 @@ class BundleVolume(object):
                     rsync.exclude(excl)
 
                 rsync.archive().hard_links().xattrs().sparse().acls()
                     rsync.exclude(excl)
 
                 rsync.archive().hard_links().xattrs().sparse().acls()
-                rsync.run('/', target)
+                rsync.run('/', target, 'host', 'tmp image')
 
                 # We need to replace the old UUID referencies with the new
                 # ones in grub configuration files and /etc/fstab for file
 
                 # We need to replace the old UUID referencies with the new
                 # ones in grub configuration files and /etc/fstab for file
index 9ae22b6..16f3c63 100644 (file)
@@ -82,7 +82,7 @@ class Rsync:
         self._exclude = []
         self._options = ['-v']
 
         self._exclude = []
         self._options = ['-v']
 
-    def run(self, src, dest):
+    def run(self, src, dest, slabel='source', dlabel='destination'):
         """Run the actual command"""
         cmd = []
         cmd.append('rsync')
         """Run the actual command"""
         cmd = []
         cmd.append('rsync')
@@ -90,7 +90,8 @@ class Rsync:
         for i in self._exclude:
             cmd.extend(['--exclude', i])
 
         for i in self._exclude:
             cmd.extend(['--exclude', i])
 
-        self._out.output("Calculating total number of host files ...", False)
+        self._out.output("Calculating total number of %s files ..." % slabel,
+                         False)
 
         # If you don't specify a destination, rsync will list the source files.
         dry_run = subprocess.Popen(cmd + [src], shell=False,
 
         # If you don't specify a destination, rsync will list the source files.
         dry_run = subprocess.Popen(cmd + [src], shell=False,
@@ -106,8 +107,8 @@ class Rsync:
 
         self._out.success("%d" % total)
 
 
         self._out.success("%d" % total)
 
-        progress = self._out.Progress(total,
-                                      "Copying host files into the image")
+        progress = self._out.Progress(total, "Copying %s files to %s" %
+                                      (slabel, dlabel))
         run = subprocess.Popen(cmd + [src, dest], shell=False,
                                stdout=subprocess.PIPE, bufsize=0)
         try:
         run = subprocess.Popen(cmd + [src, dest], shell=False,
                                stdout=subprocess.PIPE, bufsize=0)
         try: