Skip to content

Commit b9b4ac3

Browse files
committed
Rename symlink to 'include' & add to redeploy
Because redeploy.py already has a 'symlink' option that does something else.
1 parent 6ff9178 commit b9b4ac3

2 files changed

Lines changed: 16 additions & 14 deletions

File tree

‎scripts/deploy.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def download_file(self, url):
166166
)
167167
)
168168
parser.add_argument(
169-
"--symlink", nargs='*', default='./config*.json', help=(
169+
"--include", nargs='*', default='./config*.json', help=(
170170
"Symlink these files into the root of the deployed tarball. \
171171
Useful for config files and home pages. Supports glob syntax. \
172172
(Default: '%(default)s')"
@@ -187,8 +187,8 @@ def download_file(self, url):
187187

188188
deployer.symlink_paths = {}
189189

190-
for symlink in args.symlink:
191-
deployer.symlink_paths.update({ os.path.basename(pth): pth for pth in glob.iglob(symlink) })
190+
for include in args.include:
191+
deployer.symlink_paths.update({ os.path.basename(pth): pth for pth in glob.iglob(include) })
192192

193193
print("%r", (deployer.symlink_paths,))
194194

‎scripts/redeploy.py‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import time
1616
import traceback
1717
from urlparse import urljoin
18+
import glob
1819

1920
from flask import Flask, jsonify, request, abort
2021

@@ -188,15 +189,12 @@ def deploy_tarball(tar_gz_url, build_dir):
188189
)
189190
)
190191

191-
def _raise(ex):
192-
raise ex
193-
194-
# --config config.json=../../config.json --config config.localhost.json=./localhost.json
192+
# --include ../../config.json ./localhost.json homepages/*
195193
parser.add_argument(
196-
"--config", action="append", dest="configs",
197-
type=lambda kv: kv.split("=", 1) if "=" in kv else _raise(Exception("Missing =")), help=(
198-
"A list of configs to symlink into the extracted tarball. \
199-
For example, --config config.json=../config.json config2.json=../test/config.json"
194+
"--include", nargs='*', default='./config*.json', help=(
195+
"Symlink these files into the root of the deployed tarball. \
196+
Useful for config files and home pages. Supports glob syntax. \
197+
(Default: '%(default)s')"
200198
)
201199
)
202200
parser.add_argument(
@@ -220,7 +218,11 @@ def _raise(ex):
220218
deployer = Deployer()
221219
deployer.bundles_path = args.bundles_dir
222220
deployer.should_clean = args.clean
223-
deployer.config_locations = dict(args.configs) if args.configs else {}
221+
222+
deployer.symlink_paths = {}
223+
224+
for include in args.include:
225+
deployer.symlink_paths.update({ os.path.basename(pth): pth for pth in glob.iglob(include) })
224226

225227

226228
# we don't pgp-sign jenkins artifacts; instead we rely on HTTPS access to
@@ -234,13 +236,13 @@ def _raise(ex):
234236
deploy_tarball(args.tarball_uri, build_dir)
235237
else:
236238
print(
237-
"Listening on port %s. Extracting to %s%s. Symlinking to %s. Jenkins URL: %s. Config locations: %s" %
239+
"Listening on port %s. Extracting to %s%s. Symlinking to %s. Jenkins URL: %s. Include patterns: %s" %
238240
(args.port,
239241
arg_extract_path,
240242
" (clean after)" if deployer.should_clean else "",
241243
arg_symlink,
242244
arg_jenkins_url,
243-
deployer.config_locations,
245+
deployer.symlink_paths,
244246
)
245247
)
246248
app.run(host="0.0.0.0", port=args.port, debug=True)

0 commit comments

Comments
 (0)