Closed tangkong closed 1 year ago
We should be able to save audit results to a file easily
Currently we output a table with audit failures, which maybe isn't the best for dumping to a file that you might want to use for programmatic tasks.
happi audit '*' > audit_output.txt
We also print a progress ticker (x/N entries audited...), which uses a carriage return. This renders each line in the redirected output.
The table also fails to write to a file nicely, since the table width is unset in non-interactive mode.
Maybe it's best to just have a --file-out flag or something similar where we write a csv with all the audit results
--file-out
I had a task to run a happi audit periodically, I did so and there was pain
happi audit
pcds-5.7.3, happi-2.4.0
You can detect whether or not the terminal is interactive sys.__stdin__.isatty()
sys.__stdin__.isatty()
Expected Behavior
We should be able to save audit results to a file easily
Current Behavior
Currently we output a table with audit failures, which maybe isn't the best for dumping to a file that you might want to use for programmatic tasks.
A couple reasons why
happi audit '*' > audit_output.txt
is awful:We also print a progress ticker (x/N entries audited...), which uses a carriage return. This renders each line in the redirected output.
The table also fails to write to a file nicely, since the table width is unset in non-interactive mode.
Possible Solution
Maybe it's best to just have a
--file-out
flag or something similar where we write a csv with all the audit resultsContext
I had a task to run a
happi audit
periodically, I did so and there was painYour Environment
pcds-5.7.3, happi-2.4.0