Hi Rob,

> So I noticed that older versions (2.1.1) of ansible didn't have this
> problem, and I noticed that the verbosity of assert is caused by the
> following line in assert.py:
> 
> result['_ansible_verbose_always'] = True
> 
> If I comment that out, I get the quieter behavior I (and others,
> based on some reported github issues) am looking for.  So can anyone

I assume you are talking about this issue:
https://github.com/ansible/ansible/issues/27124

> explain the purpose of the above line? What is
> _ansible_verbose_always for?

That's easy: it makes the module behave as if -v is specified on the
ansible command line: it always produces verbose output when the assert
module is used.

> Why was it added to assert.py?

That's a good one. As you probably read in the issue, nobody remembers,
so it is unlikely someone suddenly can provide an explanation here :)

> Could I add another parameter to assert.py (maybe quiet) and, if set
> to True, then do not set result['_ansible_verbose_always'] to True?

Sure; that's essentially what @bcoca suggested here:
https://github.com/ansible/ansible/issues/27124#issuecomment-316855948

Feel free to create a PR which does that.

Cheers,
Felix



> I appreciate I'm
> getting into the weeds here, but I found it curious that assert got
> noisy in more recent versions.
> 
> Rob
> 
> On Wed, Feb 6, 2019 at 12:36 PM Rob Wagner <[email protected]>
> wrote:
> 
> > Thanks Felix.  That's a clever idea.  I tested it and I get:
> >
> > ok: [localhost] => (item=/dev) => {
> >     "changed": false,
> >     "item": [
> >         "/dev",
> >         "root"
> >     ],
> >     "msg": "All assertions passed"
> > }
> > ok: [localhost] => (item=/home) => {
> >     "changed": false,
> >     "item": [
> >         "/home",
> >         "root"
> >     ],
> >     "msg": "All assertions passed"
> > }
> >
> > I don't really understand why it needs to include "item" in the dict
> > (i.e., after => ), since it's already present in the output (i.e.,
> > before => ), but this is better than the original.  Thanks again.  
> >
> > Rob

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20190209161838.5a861dcc%40rovaniemi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to