-
Notifications
You must be signed in to change notification settings - Fork 654
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
base: main
Are you sure you want to change the base?
Fix to avoid spamming syslog with invoked messages #4353
Conversation
8b9c6b0
to
fb0b9fa
Compare
fb0b9fa
to
28938c1
Compare
3180e2c
to
c900411
Compare
c900411
to
e015089
Compare
def __init__(self, *args: str, **kwargs: Any) -> None: | ||
"""Initialize AnsibleModule mock.""" | ||
kwargs["no_log"] = True | ||
super().__init__(*args, **kwargs) |
There was a problem hiding this comment.
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.
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
Fix issue #4317
Description
This PR resolves the issue where
ansible-basic.py
was unnecessarily logging invoked messages to the local syslog, leading to excessive and irrelevant logging during playbook execution.Changes
CustomAnsibleModule
inargs.py
to modify the initialization process.-Preventing the unnecessary execution of
AnsibleModule
.Impact
ansible-lint
and checking logs withjournalctl | grep ansible
.