OSDN Git Service

Continue event if rsync errors.
authorTatsuki SUGIURA <sugi@osdn.jp>
Mon, 21 Oct 2019 03:15:24 +0000 (12:15 +0900)
committerTatsuki SUGIURA <sugi@osdn.jp>
Mon, 21 Oct 2019 03:15:24 +0000 (12:15 +0900)
create-image

index 97ca990..7402631 100755 (executable)
@@ -100,7 +100,9 @@ class ImageCreator
         begin
           system("mount", dev, mount_point) or raise "Failed to mount file system #{dev} on #{mount_point}"
           puts "Copying #{src_host}:#{di.srcpath} to #{dev}..."
-          system("rsync", "-azHSAX", "--numeric-ids", "--info=progress2", "#{src_host}:#{di.srcpath}/", "#{mount_point}/", *((["--exclude"] * di.exclude.size).zip(di.exclude).flatten)) or raise "rsync fails"
+          unless system("rsync", "-azHSAX", "--numeric-ids", "--info=progress2", "#{src_host}:#{di.srcpath}/", "#{mount_point}/", *((["--exclude"] * di.exclude.size).zip(di.exclude).flatten))
+            warn "rsync exit with error, file transfer may not be completed."
+          end
         ensure
           system("umount", mount_point)
           File.directory?(mount_point) and