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

Fix to avoid spamming syslog with invoked messages #4353

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion src/ansiblelint/rules/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ class ValidationPassedError(Exception):
class CustomAnsibleModule(basic.AnsibleModule): # type: ignore[misc]
"""Mock AnsibleModule class."""

def __init__(self, *args: str, **kwargs: str) -> None:
def __init__(self, *args: str, **kwargs: Any) -> None:
"""Initialize AnsibleModule mock."""
kwargs["no_log"] = True
super().__init__(*args, **kwargs)
Comment on lines +76 to 79
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really like the idea of introducing Any anywhere if we can help it. We could make the type str | bool instead, assuming that previously we are only ever calling it with strings.

Suggested change
def __init__(self, *args: str, **kwargs: Any) -> None:
"""Initialize AnsibleModule mock."""
kwargs["no_log"] = True
super().__init__(*args, **kwargs)
def __init__(self, *args: str, **kwargs: str | bool) -> None:
"""Initialize AnsibleModule mock."""
kwargs["no_log"] = True
super().__init__(*args, **kwargs)

We could instead keep the hint but instead kwargs.pop("no_log") and then pass no_log=True directly to super().__init__(), but I'm not convinced str actually is the correct type here

raise ValidationPassedError

Expand Down
Loading