Skip to content

Commit

Permalink
Add an option to always exit with status zero
Browse files Browse the repository at this point in the history
This is for Openshift as it will always restart jobs that fail:
https://docs.openshift.com/container-platform/4.15/nodes/jobs/nodes-nodes-jobs.html#jobs-limits_nodes-nodes-jobs

Signed-off-by: Aurélien Bompard <[email protected]>
  • Loading branch information
abompard committed Mar 18, 2024
1 parent 62120f6 commit 3f3d786
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mirrormanager2/crawler/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ def validate_continents(ctx, param, value):
default=False,
help="enable printing of debug-level messages",
)
@click.option(
"--no-fail",
is_flag=True,
default=False,
help="Always exit with status code zero",
)
@click.pass_context
def main(ctx, config, debug, include_disabled, categories, startid, stopid, fraction, **kwargs):
ctx.ensure_object(dict)
Expand Down Expand Up @@ -228,6 +234,8 @@ def run_on_all_hosts(ctx_obj, options, report):
duration = human_duration(time.monotonic() - starttime)
if error is None:
click.echo(f"Crawler finished after {duration}")
elif options["no-fail"]:
click.echo(f"Crawler failed after {duration}: {error}")
else:
raise click.ClickException(f"Crawler failed after {duration}: {error}")

Expand Down

0 comments on commit 3f3d786

Please sign in to comment.