Support multiple config.json symlinks in redeploy.py (#4644)

* Support multiple config.json symlinks in redeploy.py

* Review comments
This commit is contained in:
Kegsay 2017-07-20 11:02:10 +01:00 committed by GitHub
parent f7d282fc8e
commit 9864ce5bb2
2 changed files with 24 additions and 13 deletions

View file

@ -185,10 +185,16 @@ if __name__ == "__main__":
to the /vector directory INSIDE the tarball."
)
)
def _raise(ex):
raise ex
# --config config.json=../../config.json --config config.localhost.json=./localhost.json
parser.add_argument(
"--config", dest="config", help=(
"Write a symlink to config.json in the extracted tarball. \
To this location."
"--config", action="append", dest="configs",
type=lambda kv: kv.split("=", 1) if "=" in kv else _raise(Exception("Missing =")), help=(
"A list of configs to symlink into the extracted tarball. \
For example, --config config.json=../config.json config2.json=../test/config.json"
)
)
parser.add_argument(
@ -212,7 +218,8 @@ if __name__ == "__main__":
deployer = Deployer()
deployer.bundles_path = args.bundles_dir
deployer.should_clean = args.clean
deployer.config_location = args.config
deployer.config_locations = dict(args.configs) if args.configs else {}
# we don't pgp-sign jenkins artifacts; instead we rely on HTTPS access to
# the jenkins server (and the jenkins server not being compromised and/or
@ -225,13 +232,13 @@ if __name__ == "__main__":
deploy_tarball(args.tarball_uri, build_dir)
else:
print(
"Listening on port %s. Extracting to %s%s. Symlinking to %s. Jenkins URL: %s. Config location: %s" %
"Listening on port %s. Extracting to %s%s. Symlinking to %s. Jenkins URL: %s. Config locations: %s" %
(args.port,
arg_extract_path,
" (clean after)" if deployer.should_clean else "",
arg_symlink,
arg_jenkins_url,
deployer.config_location,
deployer.config_locations,
)
)
app.run(host="0.0.0.0", port=args.port, debug=True)