]> git.e2factory.org Git - e2factory.git/commitdiff
Remove now unused e2lib.ssh(), improve ssh_remote_cmd()
authorTobias Ulmer <tu@emlix.com>
Thu, 31 Oct 2013 13:03:55 +0000 (14:03 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:01:23 +0000 (15:01 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua

index a8bbfb2f01a15ab50512e6a07b91d608d7c1c650..fd03c4133f03012f07da5b5787c2cf06ba35b5b8 100644 (file)
@@ -1965,21 +1965,11 @@ function e2lib.curl(argv)
     return e2lib.call_tool_argv("curl", argv)
 end
 
---- call the ssh command
--- @param argv table: argument vector
--- @return bool
--- @return an error object on failure
-function e2lib.ssh(argv)
-    assert(type(argv) == "table")
-
-    return e2lib.call_tool_argv("ssh", argv)
-end
-
 --- Run command on remote server via SSH.
 -- @param u URL object pointing to the remote server.
 -- @param argv Command vector to run on the remote server.
 -- @return True on success, false on error.
--- @retrun Error object on failure.
+-- @return Error object on failure.
 function e2lib.ssh_remote_cmd(u, argv)
     local v, command
 
@@ -1998,24 +1988,20 @@ function e2lib.ssh_remote_cmd(u, argv)
         table.insert(v, u.user)
     end
 
-    if not u.server then
+    if not u.servername then
         return false,
-            err.new("ssh_remote_cmd: no server component in URL %q", u.url)
+            err.new("ssh_remote_cmd: no server name in URL %q", u.url)
     end
+    table.insert(v, u.servername)
 
-    table.insert(v, u.server)
-
-    command = ""
+    command = {}
     for i, arg in ipairs(argv) do
-        if i ~= 1 then
-            command = command .. " "
-        end
-        command = command .. e2lib.shquote(arg)
+        table.insert(command, e2lib.shquote(arg))
     end
 
-    table.insert(v, command)
+    table.insert(v, table.concat(command, " "))
 
-    return e2lib.ssh(v)
+    return e2lib.call_tool_argv("ssh", v)
 end
 
 --- call the scp command