]> git.e2factory.org Git - e2factory.git/commitdiff
transport: warn about scp/ssh uploads, and ignoring push_permissions
authorTobias Ulmer <tu@emlix.com>
Thu, 3 Nov 2016 17:08:16 +0000 (18:08 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:18 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/transport.lua

index 028aa256d82133c9b6708931ffcdd8abc8d07a35..d76926f5fb3585d6d6ddb5f869d671204b155231 100644 (file)
@@ -331,6 +331,9 @@ function transport.file_exists(surl, location)
     return false, e
 end
 
+local _scp_warning = true
+local _scp_warning_pp = true
+
 --- push a file to a server
 -- @param sourcefile local file
 -- @param durl url to the destination server
@@ -426,11 +429,6 @@ function transport.push_file(sourcefile, durl, location, push_permissions, try_h
         u.transport == "ssh" then
         -- scp does not remove partial destination files when
         -- interrupted. Don't use.
-        if push_permissions then
-            e:append("ssh/scp transport does not support "..
-            "permission settings")
-            return false, e
-        end
         local destdir = string.format("/%s", e2lib.dirname(u.path))
         local destname = e2lib.basename(u.path)
         local user = ""
@@ -438,6 +436,20 @@ function transport.push_file(sourcefile, durl, location, push_permissions, try_h
             user = string.format("%s@", u.user)
         end
 
+        if _scp_warning then
+            e2lib.warnf("WOTHER",
+                "ssh:// and scp:// transports may create incomplete uploads,"..
+                " please consider using rsync")
+            _scp_warning = false
+        end
+
+        if _scp_warning_pp and push_permissions then
+            e2lib.warnf("WOTHER",
+                "ssh:// and scp:// transports ignore the push_permissions "..
+                "setting, please consider using rsync")
+            _scp_warning_pp = false
+        end
+
         rc, re = e2lib.ssh_remote_cmd(u, { "mkdir", "-p", destdir })
         if not rc then
             return false, re