summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/devtool/deploy.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index 68edb98113..c152ac0b65 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -57,8 +57,11 @@ def deploy(args, config, basepath, workspace):
57 extraoptions = '' 57 extraoptions = ''
58 if args.no_host_check: 58 if args.no_host_check:
59 extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' 59 extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
60 ret = subprocess.call('scp -qr %s %s/* %s:%s' % (extraoptions, recipe_outdir, args.target, destdir), shell=True) 60 if not args.show_status:
61 extraoptions += ' -q'
62 ret = subprocess.call('scp -r %s %s/* %s:%s' % (extraoptions, recipe_outdir, args.target, destdir), shell=True)
61 if ret != 0: 63 if ret != 0:
64 logger.error('Deploy failed - rerun with -s to get a complete error message')
62 return ret 65 return ret
63 66
64 logger.info('Successfully deployed %s' % recipe_outdir) 67 logger.info('Successfully deployed %s' % recipe_outdir)
@@ -87,16 +90,20 @@ def undeploy(args, config, basepath, workspace):
87 extraoptions = '' 90 extraoptions = ''
88 if args.no_host_check: 91 if args.no_host_check:
89 extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' 92 extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
93 if not args.show_status:
94 extraoptions += ' -q'
90 95
91 ret = subprocess.call("scp -q %s %s %s:/tmp" % (extraoptions, deploy_file, args.target), shell=True) 96 ret = subprocess.call("scp %s %s %s:/tmp" % (extraoptions, deploy_file, args.target), shell=True)
92 if ret != 0: 97 if ret != 0:
93 logger.error('Failed to copy %s to %s' % (deploy, args.target)) 98 logger.error('Failed to copy file list to %s - rerun with -s to get a complete error message' % args.target)
94 return -1 99 return -1
95 100
96 ret = subprocess.call("ssh %s %s 'xargs -n1 rm -f </tmp/%s'" % (extraoptions, args.target, os.path.basename(deploy_file)), shell=True) 101 ret = subprocess.call("ssh %s %s 'xargs -n1 rm -f </tmp/%s'" % (extraoptions, args.target, os.path.basename(deploy_file)), shell=True)
97 if ret == 0: 102 if ret == 0:
98 logger.info('Successfully undeployed %s' % args.recipename) 103 logger.info('Successfully undeployed %s' % args.recipename)
99 os.remove(deploy_file) 104 os.remove(deploy_file)
105 else:
106 logger.error('Undeploy failed - rerun with -s to get a complete error message')
100 107
101 return ret 108 return ret
102 109
@@ -106,10 +113,12 @@ def register_commands(subparsers, context):
106 parser_deploy.add_argument('recipename', help='Recipe to deploy') 113 parser_deploy.add_argument('recipename', help='Recipe to deploy')
107 parser_deploy.add_argument('target', help='Live target machine running an ssh server: user@hostname[:destdir]') 114 parser_deploy.add_argument('target', help='Live target machine running an ssh server: user@hostname[:destdir]')
108 parser_deploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true') 115 parser_deploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true')
116 parser_deploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true')
109 parser_deploy.set_defaults(func=deploy) 117 parser_deploy.set_defaults(func=deploy)
110 118
111 parser_undeploy = subparsers.add_parser('undeploy-target', help='Undeploy recipe output files in live target machine') 119 parser_undeploy = subparsers.add_parser('undeploy-target', help='Undeploy recipe output files in live target machine')
112 parser_undeploy.add_argument('recipename', help='Recipe to undeploy') 120 parser_undeploy.add_argument('recipename', help='Recipe to undeploy')
113 parser_undeploy.add_argument('target', help='Live target machine running an ssh server: user@hostname') 121 parser_undeploy.add_argument('target', help='Live target machine running an ssh server: user@hostname')
114 parser_undeploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true') 122 parser_undeploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true')
123 parser_undeploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true')
115 parser_undeploy.set_defaults(func=undeploy) 124 parser_undeploy.set_defaults(func=undeploy)