pub struct Running<'r> { /* private fields */ }Expand description
A run of a project folder.
Implementations§
Source§impl Running<'_>
impl Running<'_>
Sourcepub async fn service_endpoints(
&self,
opts: &RunOptions,
) -> Result<Vec<ServiceEndpoint>>
pub async fn service_endpoints( &self, opts: &RunOptions, ) -> Result<Vec<ServiceEndpoint>>
The service endpoints the deployment publishes (a Terraform module’s published output:
{ "web/site" = "192.0.2.10:8080" }), each where this computer reaches it: as the
deployment gives it, or, when the run has a jump host (its ssh_jump value, user@host:
the deployment’s network is internal to it), at a local forward through that host, kept
open by this process (the module docs say how long). One whose forward doesn’t open says
why, the others are given all the same. opts gives what the tools get. Emits nothing and
never locks the run.
§Errors
As the deployment’s outputs can’t be read; input_invalid when the run’s ssh_jump isn’t
user@host.
Source§impl Running<'_>
impl Running<'_>
Sourcepub async fn graphical_console(
&self,
machine: &str,
opts: &RunOptions,
) -> Result<Console>
pub async fn graphical_console( &self, machine: &str, opts: &RunOptions, ) -> Result<Console>
machine’s graphical console (its screen), where its hypervisor keeps it: its protocol
(VNC or RDP), where it answers (crate::Endpoint: a port of this computer’s loopback, or
Proxmox’s VNC websocket) and the account and password that sign in. A console that
answers only on the run’s own networks (a module’s Windows VM’s Remote Desktop) is reached
through an SSH tunnel to the machine beside it the driver names: ssh -N -L 127.0.0.1:<free port>:<its address>:<its port>, signed in with the run’s key (its
ssh_private_key_file, else the runner’s) and checked against the host key the run
pinned the first time it met that machine. The returned Console owns the tunnel
(Console::tunnel): keep it while the viewer shows the screen; dropping it ends the
tunnel, and so does a down of the run. A console the hypervisor says
listens anywhere but the loopback is refused, and so is one on the loopback that doesn’t
answer. opts gives what the tools get (a Proxmox server’s address and credentials, as
its provider reads them). Emits nothing and never locks the run; while an operation holds
it, the hypervisor is asked all the same.
§Errors
machine_unknown for a machine the run doesn’t have; no_console when it has none (the
error says why: a hypervisor whose screen opens only in its own app, VirtualBox without
its extension pack…), isn’t running, its hypervisor doesn’t say where its console is or
started it without one, or it doesn’t answer there; server_auth_failed when Proxmox
refuses the run’s credentials; a tool’s own failure (tool_missing for a missing virsh,
VBoxManage, curl, ssh or ssh-keyscan); tool_failed when the machine a tunnel goes
through gives no SSH host key to pin.
Sourcepub async fn native_console(
&self,
machine: &str,
opts: &RunOptions,
) -> Result<NativeConsole>
pub async fn native_console( &self, machine: &str, opts: &RunOptions, ) -> Result<NativeConsole>
What opens running VM machine in its hypervisor’s own app, beside the embedder’s viewer
(crate::Status::native names the app): a program and its arguments, a macOS app and
what it opens, or an https URL, best first, each argument checked; the embedder runs the
first this computer has, never through a shell. Reads as Running::graphical_console
does, and runs nothing but a read (Parallels’ prlctl, UTM’s utmctl, libvirt’s virsh).
§Errors
machine_unknown for a machine the run doesn’t have; no_console when its hypervisor has
no app (QEMU, ESXi, a container), it isn’t running, or what names it can’t be handed to
the app as it is.
Source§impl<'r> Running<'r>
impl<'r> Running<'r>
Sourcepub fn sharing_elevation(self) -> Running<'r>
pub fn sharing_elevation(self) -> Running<'r>
The same run, every operation of this handle sharing one elevation where its hypervisor
needs one (Hyper-V on Windows): one administrator prompt for an up and the exec after
it, say, instead of one per operation. The elevated session ends when the handle drops.
Source§impl Running<'_>
impl Running<'_>
Sourcepub async fn status(&self) -> Result<Status>
pub async fn status(&self) -> Result<Status>
The run as its tool reports it now, reconciled with its record: an operation of this process on the run leaves the machines as last read (not live).
§Errors
As the tool fails to answer; the store’s.
Sourcepub async fn status_with(&self, opts: &RunOptions) -> Result<Status>
pub async fn status_with(&self, opts: &RunOptions) -> Result<Status>
Running::status, its tools given opts’ values and secrets beside the recorded ones:
what a read of the project’s own servers needs (a Proxmox VE module’s API token, for its
VMs’ states on the server).
§Errors
As Running::status; server_auth_failed when a server refuses the credentials.
Sourcepub async fn usage(&self, opts: &RunOptions) -> Result<Vec<MachineUsage>>
pub async fn usage(&self, opts: &RunOptions) -> Result<Vec<MachineUsage>>
What each running machine of the run uses now, by name, as its engine samples it once:
a Compose project’s containers (docker stats); none for a format whose tool reports no
per-machine figure (Vagrant, Terraform). A machine not running has none. opts gives
what the tools get. Emits nothing and never locks the run.
§Errors
As the tool fails: its engine doesn’t answer, or its answer can’t be read.
Source§impl<'r> Running<'r>
impl<'r> Running<'r>
Sourcepub async fn up(
&self,
opts: &RunOptions,
events: &dyn Events,
) -> Result<Started>
pub async fn up( &self, opts: &RunOptions, events: &dyn Events, ) -> Result<Started>
Starts the run: makes and starts everything, and returns once the project says it’s ready.
§Errors
Fails, after its error event, as the run’s tool does (missing, too old, failing, out of
time), with port_in_use for a host port taken, or as the run’s state refuses an up:
already_running for a run that is ready and live (its tool says so now), before any tool
acts. A run recorded ready whose machines are gone or stopped meanwhile starts again.
Sourcepub async fn down(&self, opts: &RunOptions, events: &dyn Events) -> Result<()>
pub async fn down(&self, opts: &RunOptions, events: &dyn Events) -> Result<()>
Removes everything the run made, the tunnels of its consoles ended first (whichever process holds them), and forgets its machines’ pinned SSH host keys.
§Errors
As Running::up’s tool failures.
Sourcepub async fn park(
&self,
mode: Park,
opts: &RunOptions,
events: &dyn Events,
) -> Result<()>
pub async fn park( &self, mode: Park, opts: &RunOptions, events: &dyn Events, ) -> Result<()>
Stops the machines and keeps them, as mode says.
§Errors
As the tool fails, or as the run’s state refuses a park.
Sourcepub async fn resume(&self, opts: &RunOptions, events: &dyn Events) -> Result<()>
pub async fn resume(&self, opts: &RunOptions, events: &dyn Events) -> Result<()>
Starts the parked machines again.
§Errors
As the tool fails, or as the run’s state refuses a resume: nothing_to_resume for a run
of which nothing is left (never started, brought down, or its parked machines removed
meanwhile: its record then reads absent), before any tool acts.
Sourcepub async fn update(&self, opts: &RunOptions, events: &dyn Events) -> Result<()>
pub async fn update(&self, opts: &RunOptions, events: &dyn Events) -> Result<()>
Brings the running run to what the project’s files now say.
§Errors
As the tool fails; not_running, before any tool acts, when the run isn’t ready.
Sourcepub async fn provision(
&self,
machine: Option<&str>,
with: Option<&str>,
opts: &RunOptions,
events: &dyn Events,
) -> Result<()>
pub async fn provision( &self, machine: Option<&str>, with: Option<&str>, opts: &RunOptions, events: &dyn Events, ) -> Result<()>
Runs the project’s set-up again (its provisioners), on machine or on every machine.
§Errors
As the tool fails; unsupported where the format has no set-up of its own to run again;
not_running, before any tool acts, when nothing of the run runs. with, when given, runs
only the provisioner of that name (a Vagrant project’s checks).
Sourcepub async fn attach(
&self,
machine: &str,
opts: &RunOptions,
events: &dyn Events,
) -> Result<()>
pub async fn attach( &self, machine: &str, opts: &RunOptions, events: &dyn Events, ) -> Result<()>
Starts machine, one the project leaves down at up.
§Errors
As the tool fails; unsupported where the format has no such machine; not_running,
before any tool acts, when nothing of the run runs.
Sourcepub async fn retire(
&self,
machine: &str,
opts: &RunOptions,
events: &dyn Events,
) -> Result<()>
pub async fn retire( &self, machine: &str, opts: &RunOptions, events: &dyn Events, ) -> Result<()>
Removes machine from the running run.
§Errors
As the tool fails; not_running, before any tool acts, when the run isn’t ready.
Sourcepub async fn package(
&self,
machine: &str,
output: &Path,
opts: &RunOptions,
events: &dyn Events,
) -> Result<()>
pub async fn package( &self, machine: &str, output: &Path, opts: &RunOptions, events: &dyn Events, ) -> Result<()>
Saves machine as a box file at output, which a later run boots from (vagrant box add
it first): the machine is stopped first and kept, so the run reads failed after, until it
is resumed or brought down.
§Errors
As the tool fails; unsupported where the format makes no box (Compose, Terraform);
not_running, before any tool acts, when the run isn’t ready.
Sourcepub async fn exec(
&self,
machine: &str,
argv: &[String],
opts: &RunOptions,
events: &dyn Events,
) -> Result<ExecReport>
pub async fn exec( &self, machine: &str, argv: &[String], opts: &RunOptions, events: &dyn Events, ) -> Result<ExecReport>
Runs argv in machine, with no terminal: what it said and how it ended. A command that
runs and fails is a report, not an error.
§Errors
When the command can’t be run at all (the tool missing, the machine refused);
not_running, before any tool acts, when nothing of the run runs.
Sourcepub async fn console_command(
&self,
machine: &str,
user: Option<&str>,
) -> Result<ShellCommand>
pub async fn console_command( &self, machine: &str, user: Option<&str>, ) -> Result<ShellCommand>
The command that opens an interactive console into machine, as user when given. A
query: nothing runs.
§Errors
Where the format has no way in.