Skip to content

Commit

Permalink
Merge pull request #56 from jhamman/cleanup
Browse files Browse the repository at this point in the history
add atomic and cleanup args to hubploy cli
  • Loading branch information
yuvipanda authored Mar 13, 2020
2 parents 66ccc26 + c3f270f commit d619b2d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
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
)

0 comments on commit d619b2d

Please sign in to comment.