8000 feat: Implement returning error code to anta functions by gmuloc · Pull Request #196 · aristanetworks/anta · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Implement returning error code to anta functions #196

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

Merged
merged 5 commits into from
Jul 4, 2023

Conversation

gmuloc
Copy link
Collaborator
@gmuloc gmuloc commented May 12, 2023

Fixes #192 (even if apparently I can't even name my branches right!)

Behavior tested locally with the various new CLI flags

@gmuloc gmuloc requested a review from titom73 May 12, 2023 15:27
@gmuloc gmuloc changed the title Feat: Implement returning error code to anta functions feat: Implement returning error code to anta functions May 12, 2023
@github-actions
Copy link
Contributor
github-actions bot commented Jun 9, 2023

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor
github-actions bot commented Jul 3, 2023

Conflicts have been resolved. A maintainer will review the pull request shortly.

@gmuloc gmuloc requested a review from mtache July 4, 2023 12:46
@gmuloc gmuloc marked this pull request as ready for review July 4, 2023 12:46
@@ -55,11 +55,15 @@
),
callback=setup_logging,
)
@click.option("--ignore-status", show_envvar=True, default=False, help="Always exit with success", is_eager=True)
@click.option("--ignore-error", show_envvar=True, default=False, help="Only report failures and not errors", is_eager=True)
def anta(ctx: click.Context, inventory: AntaInventory, **kwargs: Dict[str, Any]) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible to do that:

Suggested change
def anta(ctx: click.Context, inventory: AntaInventory, **kwargs: Dict[str, Any]) -> None:
def anta(ctx: click.Context, inventory: AntaInventory, ignore_status: bool, ignore_error: bool, **kwargs: Dict[str, Any]) -> None:

@@ -55,11 +55,15 @@
),
callback=setup_logging,
)
@click.option("--ignore-status", show_envvar=True, default=False, help="Always exit with success", is_eager=True)
Copy link
Collaborator
@mtache mtache Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_eager is not needed here.
Also, defining options like this means you wants a boolean as parameter.

anta --help
  --ignore-status BOOLEAN         Always exit with success  [env var:
                                  ANTA_IGNORE_STATUS]
  --ignore-error BOOLEAN          Only report failures and not errors  [env
                                  var: ANTA_IGNORE_ERROR]

You need

Suggested change
@click.option("--ignore-status", show_envvar=True, default=False, help="Always exit with success", is_eager=True)
@click.option("--ignore-status", is_flag=True, show_envvar=True, default=False, help="Always exit with success")

Could you also update the insecure flag with the is_flag=True param ?

gmuloc added 5 commits July 4, 2023 17:43
Feat: Add ExitCode Enum
Feat: Add options for main CLI
Bump: Fix python versions of pydantic and mypy
@mtache mtache merged commit 5fc80eb into aristanetworks:master Jul 4, 2023
@gmuloc gmuloc deleted the issue/12 branch January 15, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Raise on error in the report part for CI
2 participants
0