Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add atomic and cleanup args to hubploy cli #56

Merged
merged 1 commit into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion hubploy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ def main():
'--force',
action='store_true'
)
deploy_parser.add_argument(
'--atomic',
action='store_true'
)
deploy_parser.add_argument(
'--cleanup-on-fail',
action='store_true'
)

args = argparser.parse_args()

Expand All @@ -91,7 +99,7 @@ def main():

elif args.command == 'deploy':
auth.cluster_auth(args.deployment)
helm.deploy(args.deployment, args.chart, args.environment, args.namespace, args.set, args.version, args.timeout, args.force)
helm.deploy(args.deployment, args.chart, args.environment, args.namespace, args.set, args.version, args.timeout, args.force, args.atomic, args.cleanup_on_fail)

if __name__ == '__main__':
main()
16 changes: 13 additions & 3 deletions hubploy/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def helm_upgrade(
config_overrides,
version,
timeout,
force
force,
atomic,
cleanup_on_fail
):
# Clear charts and do a helm dep up before installing
# Clearing charts is important so we don't deploy charts that
Expand Down Expand Up @@ -82,6 +84,10 @@ def helm_upgrade(
cmd += ['--timeout', timeout]
if force:
cmd += ['--force']
if atomic:
cmd += ['--atomic']
if cleanup_on_fail:
cmd += ['--cleanup-on-fail']
cmd += itertools.chain(*[['-f', cf] for cf in config_files])
cmd += itertools.chain(*[['--set', v] for v in config_overrides])
subprocess.check_call(cmd)
Expand All @@ -95,7 +101,9 @@ def deploy(
helm_config_overrides=None,
version=None,
timeout=None,
force=False
force=False,
atomic=False,
cleanup_on_fail=False
):
"""
Deploy a JupyterHub.
Expand Down Expand Up @@ -148,5 +156,7 @@ def deploy(
helm_config_overrides,
version,
timeout,
force
force,
atomic,
cleanup_on_fail
)