From: Nikos Skalkotos Date: Fri, 4 Jan 2013 11:17:24 +0000 (+0200) Subject: In rsync make src and dest labels configurable X-Git-Tag: v0.2~14 X-Git-Url: https://code.grnet.gr/git/snf-image-creator/commitdiff_plain/63e1b902670d78f62cd75c1d154bcbd2fd6e15ae In rsync make src and dest labels configurable --- diff --git a/image_creator/bundle_volume.py b/image_creator/bundle_volume.py index ff4861e..e86d613 100644 --- a/image_creator/bundle_volume.py +++ b/image_creator/bundle_volume.py @@ -385,7 +385,7 @@ class BundleVolume(object): 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 diff --git a/image_creator/rsync.py b/image_creator/rsync.py index 9ae22b6..16f3c63 100644 --- a/image_creator/rsync.py +++ b/image_creator/rsync.py @@ -82,7 +82,7 @@ class Rsync: 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') @@ -90,7 +90,8 @@ class Rsync: 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, @@ -106,8 +107,8 @@ class Rsync: 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: