Some number of tasks I will want to be "builtin" and need to know a little bit
more about the transport in order to make that work.
The traits, they are coming.
See #1
Since I refactored a Transport to allow for maintaining a connection, subsequent
commands were being run on the same target. This ensures that when a group is
being run, that the session is flushed between connections
ExecutableTask needs to find a new home, and some other things still need to get
shuffled around. This commit does however copy a temp file over for execution
which seems to be the best possible scenario for safe execution
An example run:
❯ RUST_LOG=debug ./target/debug/zap task tasks/shell/bash.ztask -p "script=set -xe; pwd" -t zap-freebsd
Running task with: TaskOpts { task: "tasks/shell/bash.ztask", parameter: ["script=set -xe; pwd"], targets: "zap-freebsd" }
INFO zap > Task located, preparing to execute
DEBUG handlebars::render > Rendering value: Path(Relative(([Named("script")], "script")))
DEBUG handlebars::context > Accessing context value: AbsolutePath(["script"])
err: + pwd
/root
With some real integration testing it looks like the "set an environment
variable" approach is not really going to work effectively.
I think the script {} will need to be treated like a template instead, since
different shells require different ways of setting env variables and it doesn't
appear that there's a good ssh2-based way to set these environment variables.
I'm still not thrilled with the need to hard-code some things here, and tried to
use the enum_dispatch crate to make the transport mapping go directly from
inventory::Transport to transport::Ssh. Didn't work because it needs to be
struct/tuple syntax