From: Tobias Ulmer Date: Thu, 3 Nov 2016 17:08:16 +0000 (+0100) Subject: transport: warn about scp/ssh uploads, and ignoring push_permissions X-Git-Tag: e2factory-2.3.15rc1~19 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=bae7e7be7b7e66098b95bcf9b77999d56b7b1348;p=e2factory.git transport: warn about scp/ssh uploads, and ignoring push_permissions Signed-off-by: Tobias Ulmer --- diff --git a/generic/transport.lua b/generic/transport.lua index 028aa25..d76926f 100644 --- a/generic/transport.lua +++ b/generic/transport.lua @@ -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