summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlaf Mandel <o.mandel@menlosystems.com>2019-02-21 13:10:45 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-02-25 10:43:07 +0000
commit4cae7e17b13dbe162aaadb43b9b8540f88d84891 (patch)
tree7ad034130fd287510125756fad4e04f898e3cce3
parentf16eee49469295eed7fbdafa738c60fe63c57e40 (diff)
downloadpoky-4cae7e17b13dbe162aaadb43b9b8540f88d84891.tar.gz
devtool: deploy-target: allow use of alternate ssh
Allow the use of an alternate SSH executable for deploy-target and undeploy-target. The command can be specified with -e / --ssh-exec. (From OE-Core rev: c2684740d7fd3aeb60b3ec7888000097effe82f4) Signed-off-by: Olaf Mandel <o.mandel@menlosystems.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/devtool/deploy.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index 886004b5d0..f345f31b7b 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -211,6 +211,11 @@ def deploy(args, config, basepath, workspace):
211 if not args.show_status: 211 if not args.show_status:
212 extraoptions += ' -q' 212 extraoptions += ' -q'
213 213
214 scp_sshexec = ''
215 ssh_sshexec = 'ssh'
216 if args.ssh_exec:
217 scp_sshexec = "-S %s" % args.ssh_exec
218 ssh_sshexec = args.ssh_exec
214 scp_port = '' 219 scp_port = ''
215 ssh_port = '' 220 ssh_port = ''
216 if args.port: 221 if args.port:
@@ -238,7 +243,7 @@ def deploy(args, config, basepath, workspace):
238 for fpath, fsize in filelist: 243 for fpath, fsize in filelist:
239 f.write('%s %d\n' % (fpath, fsize)) 244 f.write('%s %d\n' % (fpath, fsize))
240 # Copy them to the target 245 # Copy them to the target
241 ret = subprocess.call("scp %s %s %s/* %s:%s" % (scp_port, extraoptions, tmpdir, args.target, os.path.dirname(tmpscript)), shell=True) 246 ret = subprocess.call("scp %s %s %s %s/* %s:%s" % (scp_sshexec, scp_port, extraoptions, tmpdir, args.target, os.path.dirname(tmpscript)), shell=True)
242 if ret != 0: 247 if ret != 0:
243 raise DevtoolError('Failed to copy script to %s - rerun with -s to ' 248 raise DevtoolError('Failed to copy script to %s - rerun with -s to '
244 'get a complete error message' % args.target) 249 'get a complete error message' % args.target)
@@ -246,7 +251,7 @@ def deploy(args, config, basepath, workspace):
246 shutil.rmtree(tmpdir) 251 shutil.rmtree(tmpdir)
247 252
248 # Now run the script 253 # Now run the script
249 ret = exec_fakeroot(rd, 'tar cf - . | ssh %s %s %s \'sh %s %s %s %s\'' % (ssh_port, extraoptions, args.target, tmpscript, args.recipename, destdir, tmpfilelist), cwd=recipe_outdir, shell=True) 254 ret = exec_fakeroot(rd, 'tar cf - . | %s %s %s %s \'sh %s %s %s %s\'' % (ssh_sshexec, ssh_port, extraoptions, args.target, tmpscript, args.recipename, destdir, tmpfilelist), cwd=recipe_outdir, shell=True)
250 if ret != 0: 255 if ret != 0:
251 raise DevtoolError('Deploy failed - rerun with -s to get a complete ' 256 raise DevtoolError('Deploy failed - rerun with -s to get a complete '
252 'error message') 257 'error message')
@@ -276,6 +281,11 @@ def undeploy(args, config, basepath, workspace):
276 if not args.show_status: 281 if not args.show_status:
277 extraoptions += ' -q' 282 extraoptions += ' -q'
278 283
284 scp_sshexec = ''
285 ssh_sshexec = 'ssh'
286 if args.ssh_exec:
287 scp_sshexec = "-S %s" % args.ssh_exec
288 ssh_sshexec = args.ssh_exec
279 scp_port = '' 289 scp_port = ''
280 ssh_port = '' 290 ssh_port = ''
281 if args.port: 291 if args.port:
@@ -292,7 +302,7 @@ def undeploy(args, config, basepath, workspace):
292 with open(os.path.join(tmpdir, os.path.basename(tmpscript)), 'w') as f: 302 with open(os.path.join(tmpdir, os.path.basename(tmpscript)), 'w') as f:
293 f.write(shellscript) 303 f.write(shellscript)
294 # Copy it to the target 304 # Copy it to the target
295 ret = subprocess.call("scp %s %s %s/* %s:%s" % (scp_port, extraoptions, tmpdir, args.target, os.path.dirname(tmpscript)), shell=True) 305 ret = subprocess.call("scp %s %s %s %s/* %s:%s" % (scp_sshexec, scp_port, extraoptions, tmpdir, args.target, os.path.dirname(tmpscript)), shell=True)
296 if ret != 0: 306 if ret != 0:
297 raise DevtoolError('Failed to copy script to %s - rerun with -s to ' 307 raise DevtoolError('Failed to copy script to %s - rerun with -s to '
298 'get a complete error message' % args.target) 308 'get a complete error message' % args.target)
@@ -300,7 +310,7 @@ def undeploy(args, config, basepath, workspace):
300 shutil.rmtree(tmpdir) 310 shutil.rmtree(tmpdir)
301 311
302 # Now run the script 312 # Now run the script
303 ret = subprocess.call('ssh %s %s %s \'sh %s %s\'' % (ssh_port, extraoptions, args.target, tmpscript, args.recipename), shell=True) 313 ret = subprocess.call('%s %s %s %s \'sh %s %s\'' % (ssh_sshexec, ssh_port, extraoptions, args.target, tmpscript, args.recipename), shell=True)
304 if ret != 0: 314 if ret != 0:
305 raise DevtoolError('Undeploy failed - rerun with -s to get a complete ' 315 raise DevtoolError('Undeploy failed - rerun with -s to get a complete '
306 'error message') 316 'error message')
@@ -324,6 +334,7 @@ def register_commands(subparsers, context):
324 parser_deploy.add_argument('-n', '--dry-run', help='List files to be deployed only', action='store_true') 334 parser_deploy.add_argument('-n', '--dry-run', help='List files to be deployed only', action='store_true')
325 parser_deploy.add_argument('-p', '--no-preserve', help='Do not preserve existing files', action='store_true') 335 parser_deploy.add_argument('-p', '--no-preserve', help='Do not preserve existing files', action='store_true')
326 parser_deploy.add_argument('--no-check-space', help='Do not check for available space before deploying', action='store_true') 336 parser_deploy.add_argument('--no-check-space', help='Do not check for available space before deploying', action='store_true')
337 parser_deploy.add_argument('-e', '--ssh-exec', help='Executable to use in place of ssh')
327 parser_deploy.add_argument('-P', '--port', help='Specify port to use for connection to the target') 338 parser_deploy.add_argument('-P', '--port', help='Specify port to use for connection to the target')
328 339
329 strip_opts = parser_deploy.add_mutually_exclusive_group(required=False) 340 strip_opts = parser_deploy.add_mutually_exclusive_group(required=False)
@@ -346,5 +357,6 @@ def register_commands(subparsers, context):
346 parser_undeploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true') 357 parser_undeploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true')
347 parser_undeploy.add_argument('-a', '--all', help='Undeploy all recipes deployed on the target', action='store_true') 358 parser_undeploy.add_argument('-a', '--all', help='Undeploy all recipes deployed on the target', action='store_true')
348 parser_undeploy.add_argument('-n', '--dry-run', help='List files to be undeployed only', action='store_true') 359 parser_undeploy.add_argument('-n', '--dry-run', help='List files to be undeployed only', action='store_true')
360 parser_undeploy.add_argument('-e', '--ssh-exec', help='Executable to use in place of ssh')
349 parser_undeploy.add_argument('-P', '--port', help='Specify port to use for connection to the target') 361 parser_undeploy.add_argument('-P', '--port', help='Specify port to use for connection to the target')
350 parser_undeploy.set_defaults(func=undeploy) 362 parser_undeploy.set_defaults(func=undeploy)