summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-03-10 14:42:36 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-20 11:27:47 +0000
commit8123b4aa6288bec76012f2895143c08b8bbd597c (patch)
tree3c77ecd86fbd6c91f2d2a89acc82f724e77007b3 /scripts
parenta5047717bd11d332fc9f4320beaa26719de1793c (diff)
downloadpoky-8123b4aa6288bec76012f2895143c08b8bbd597c.tar.gz
devtool: deploy-target: add dry-run option
Add a dry-run option to the deploy-target and undeploy-target subcommands so you can see the list of files to be deployed or un-deployed before actually carrying out the operation. (From OE-Core rev: b9625581f3fe72fc402632be2d87cf889301c6a2) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/devtool/deploy.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index c152ac0b65..f016b23dba 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -49,6 +49,13 @@ def deploy(args, config, basepath, workspace):
49 logger.error('No files to deploy - have you built the %s recipe? If so, the install step has not installed any files.' % args.recipename) 49 logger.error('No files to deploy - have you built the %s recipe? If so, the install step has not installed any files.' % args.recipename)
50 return -1 50 return -1
51 51
52 if args.dry_run:
53 print('Files to be deployed for %s on target %s:' % (args.recipename, args.target))
54 for root, dirs, files in os.walk(recipe_outdir):
55 for fn in files:
56 print(' %s' % os.path.join(destdir, os.path.relpath(root, recipe_outdir), fn))
57 return 0
58
52 if os.path.exists(deploy_file): 59 if os.path.exists(deploy_file):
53 if undeploy(args, config, basepath, workspace): 60 if undeploy(args, config, basepath, workspace):
54 # Error already shown 61 # Error already shown
@@ -87,6 +94,13 @@ def undeploy(args, config, basepath, workspace):
87 logger.error('%s has not been deployed' % args.recipename) 94 logger.error('%s has not been deployed' % args.recipename)
88 return -1 95 return -1
89 96
97 if args.dry_run:
98 print('Previously deployed files to be un-deployed for %s on target %s:' % (args.recipename, args.target))
99 with open(deploy_file, 'r') as f:
100 for line in f:
101 print(' %s' % line.rstrip())
102 return 0
103
90 extraoptions = '' 104 extraoptions = ''
91 if args.no_host_check: 105 if args.no_host_check:
92 extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' 106 extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
@@ -114,6 +128,7 @@ def register_commands(subparsers, context):
114 parser_deploy.add_argument('target', help='Live target machine running an ssh server: user@hostname[:destdir]') 128 parser_deploy.add_argument('target', help='Live target machine running an ssh server: user@hostname[:destdir]')
115 parser_deploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true') 129 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') 130 parser_deploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true')
131 parser_deploy.add_argument('-n', '--dry-run', help='List files to be deployed only', action='store_true')
117 parser_deploy.set_defaults(func=deploy) 132 parser_deploy.set_defaults(func=deploy)
118 133
119 parser_undeploy = subparsers.add_parser('undeploy-target', help='Undeploy recipe output files in live target machine') 134 parser_undeploy = subparsers.add_parser('undeploy-target', help='Undeploy recipe output files in live target machine')
@@ -121,4 +136,5 @@ def register_commands(subparsers, context):
121 parser_undeploy.add_argument('target', help='Live target machine running an ssh server: user@hostname') 136 parser_undeploy.add_argument('target', help='Live target machine running an ssh server: user@hostname')
122 parser_undeploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true') 137 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') 138 parser_undeploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true')
139 parser_undeploy.add_argument('-n', '--dry-run', help='List files to be undeployed only', action='store_true')
124 parser_undeploy.set_defaults(func=undeploy) 140 parser_undeploy.set_defaults(func=undeploy)