This includes the necessary refactoring needed to enable this feature.
Refactoring
Moved .tar.gzipping out of the Agent and into the utils package. It's now called from the cli (run.go).
Added a MultiWriter to let us multiplex output.
Rewrote tempfile creation to allow this, and moved it out of the Agent and into the utils package.
Tempdir path and logfile for the hcdiag run are now created in the cli (run.go). Tempdir location is passed into the Agent with a new Agent.Config field.
Deprecated Agent.TmpDir() and Agent.resultsDest -- they were more or less unused
TODO:
log coloring is currently broken (via the config in run.go). I'll try to come up with a clever way around this -- maybe I'll write a logging wrapper that takes the MultiWriter and writes to all writers it contains, in addition to making regular hclog calls to stdout (with coloring).
Tests for moved functions (createTemp stuff should be moved from agent_test.go to util/util_test.go).
A thorough functional look to make sure this all works. I've tested it in a docker container and it behaves how I'd expect so far.
This includes the necessary refactoring needed to enable this feature.
Refactoring
utils
package. It's now called from the cli (run.go
).utils
package.run.go
). Tempdir location is passed into the Agent with a new Agent.Config field.TODO:
MultiWriter
and writes to all writers it contains, in addition to making regular hclog calls to stdout (with coloring).agent_test.go
toutil/util_test.go
).This PR implements the work outlined in https://hashicorp.atlassian.net/browse/CORI2-188