CLI context manager to support returning path
Adds a new CLIHelperFile class that will return a path
to a file containing the output of the command. This
is so that we can stop using mktemp_dump() to dump
contents of command output to a file which is redundant
if the output came from a file in the first place e.g.
with a sosreport.
At least I think that's the one.
I wasn't able to figure this out yet, but you can see an example here that will make sense of this:
Running the unit tests with 'tox -e py3' creates some temporary test files in /tmp, but doesn't clean-up when done. These are the files:
hotsos-unit-test-juju-bug-lp1852502.txt hotsos-unit-test-lxcfs-libfuse-deadlock.txt hotsos-unit-test-oslo-privsep-errors-l3-agent.txt hotsos-unit-test-oslo-privsep-errors-ovs-agent.txt hotsos-unit-test-ovs-service-restarts.txt
I traced this back to this change:
commit 8efea48a4f4f8a6eb202e262c75205f4b47644a0 (tag: 1.16.0) Author: Edward Hope-Morley edward.hope-morley@canonical.com Date: Fri Jul 14 14:18:45 2023 +0100
At least I think that's the one.
I wasn't able to figure this out yet, but you can see an example here that will make sense of this:
hotsos/defs/tests/scenarios/juju/bugs/lp1852502.yaml
And to run just that one test for debugging:
tox -e py3 -- tests.unit.test_juju.TestJujuScenarios.test_yscenario_bugs_lp1852502