Add --quiet to run command to surpress any output

Issue #661 closed
Till Maas
created an issue

In https://github.com/linux-system-roles/network I would like to use coverage.py as a wrapper to get coverage info from Ansible runs, such as:

cd tests
playbook=tests_default.yml
host=centos7
coverage_args="run -p --include *ansible_module_network_connections.py"
ANSIBLE_KEEP_REMOTE_FILES=1 ansible-playbook -i "${host}", "${playbook}" -e "ansible_python_interpreter='${coverage} ${coverage_args}'"

The problem is that when coverage does not gather any data, it outputs a warning and this breaks Ansible. I work around this by also deploying a coveragerc on the test host:

[run]
disable_warnings = no-data-collected

But IMHO there should be a flag like "coverage run --quiet" that makes coverage not output anything.

Comments (4)

  1. Ned Batchelder repo owner

    I like the explicit suppression of the warnings you don't care about, as you are already doing. Using a --quiet switch would mean you are assuming you know what is being suppressed. Why would you prefer a blunt tool like --quiet to the precise tool you are already using?

  2. Till Maas reporter

    I would prefer a tool that I can run remotely without too many side effects. Being able to surpress the warnings on the command-line individually would be ok, too. Nevertheless I would also prefer if the tool could be told to not use stderr or stdout at all and report warnings just via syslog or embed them into coverage files. In my case "coverage run" is just a piece of a bigger tool that can create warnings such as these after all coverage files are collected. Then it would make sense in my case to warn about no data being collected.

    Also being able to be less precise helps to develop a prototype faster to see if things work at all without having to fine tune every knob. :-)

  3. Log in to comment