-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
[WIP] Issue 24215: Enable verbosity setting on a per-task basis. #41621
base: devel
Are you sure you want to change the base?
Conversation
@@ -152,7 +152,7 @@ def _print_task_banner(self, task): | |||
args = u' %s' % args | |||
|
|||
self._display.banner(u"TASK [%s%s]" % (task.get_name().strip(), args)) | |||
if self._display.verbosity >= 2: | |||
if self._display.verbosity >= 2 or task.verbosity >= 2: |
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.
Currently it seems like this is the only place where the task-specific increased verbosity is working as intended.
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.
Nevermind, I figured it out.
The test
|
The test
|
We already allow
This PR may not apply to blocks when it should and verbosity should be inherited up |
As #68084 was closed, and this one seems the most relevant, it might be useful to bump the verbosity of a task up from normal, so that I can have my own debug verbosity setting not get overran by other modules. As an example, I want to add some additional data with a verbosity of 1 to some debug statements, but when doing so, using a module such as win_robocopy, or synchronize, or some other module which might make lots and lots of operations, I would like to modify the minimum verbosity of synchronize or win_robocopy output to 2, instead of 1, so that I can implement my own debug without getting literally megabytes of console output. I'm certainly open to other suggestions that might make this possible if this is not appropriate. |
This is a feature that I would have used today. However this pull request is two years old and there isn't a comment from anybody with commit rights on:
Could somebody that has commit rights please let the people here know what the plan is wrt to this pull request? |
I'd be happy to rebase this onto the latest devel branch if one of the maintainers does happen to be open to it. I had totally forgotten about it until I got an email notification about the latest comment. |
@waynr this PR is just so obviously helpful - thank you! |
A few issues with this:
The main reason we have not implemented this is due to the lack of 'single source of verbosity truth' .. which is what this accomplishes #77498. Now we can deal with verbosity to ALMOST cover the 'whole task' when executing .. still leaves the callback as a problem as it executes in a different process/context (but moving those to rely on task value instead of display as this PR does might solve that). |
Has there been any update on this? |
Fixes #24215
This PR adds a new attribute/directive to the base Task class that enables users to specify verbosity level on a per-task basis, as described in #24215
It was also suggested in IRC that this behavior be added to the Block class, but I am leaving that alone for now since it's not yet clear to me how task instances can inherit from enclosing block instances.
lib/ansible/playbook/task.py
lib/ansible/plugins/callback/default.py
The current implementation in the PR branch doesn't quite work as expected, so I am submitting this WIP PR to solicit advice from those more experienced with the codebase.
Left TODO:
Behavior before this change:
Behavior after this change:
Note that the first two tasks are simply
ok
and the third one ischanged
in both the before and the after examples shown above. The first task has no task-specific verbosity set; the second task hasverbosity: 3
, and the third hasverbosity: 5
.Also, please forgive my lazyness in not putting together a full contrived example and instead using a snippet from the output of an existing playbook.
Also also, I'm not quite sure why the output shown here isn't even more verbose. The additional output resulting from this implementation doesn't match what I would expect from output when passing
-vvv
on the command line where the additional output shown here would be pretty print formatted and task stdout/stderr would be shown as if the tasks' command had been run locally.