Skip to main content

Crate isothrum_machine

Crate isothrum_machine 

Source
Expand description

The machine-setup domain: this computer (Host: its OS, CPU, package manager and the files detection reads), which Vagrant providers (hypervisors) it can drive, and the machine check (check::check): its tools, Docker-compatible engines, package manager, cloud CLIs and, on Windows, WSL 2; a guided setup’s options and plan from that check (setup); installing and removing the tools it runs projects with (install); the self-tests that prove it runs deployments (selftest); what a run needs here and what of it is missing, with the plan that brings it (requirements); and the cloud accounts its cloud CLIs are signed in to (cloud): whether a sign-in holds, and what an account offers; the boxes Vagrant holds here and adds (boxes); and this computer’s public address, as independent services agree on it (net).

Every tool runs through the Isothrum runner’s no-unsafe isothrum_runner::ProcessRunner, so nothing here forks a shell or touches raw process APIs. A caller hands it a Context: the runner (the real isothrum_runner::SystemProcesses, or a strict fake in tests), the Host and a probe time limit. The crate keeps no statics and holds no UI types: a reason is a code (providers::Unavailable) a UI translates, with an English message().

Re-exports§

pub use failure::Failure;
pub use failure::Refusal;
pub use host::Devices;
pub use host::Host;
pub use host::LinuxPackages;
pub use host::Packages;

Modules§

boxes
Vagrant’s boxes on this computer: which are held for a provider and this CPU (vagrant box list), and a box added (vagrant box add), its download handed back for a caller that keeps a record of its downloads, or a box file saved here added under a name (add_file: a run’s machine saved by Running::package). What uses a box (a self-test’s, a project’s) picks it.
check
The machine check: what this computer has, in one report. The tools (crate::tools), the Docker-compatible engines and their contexts (crate::docker), the package manager, the cloud CLIs, the Vagrant providers (crate::providers), WSL 2 on Windows (crate::wsl) and the groups this account joined since logging in. Each part is asked side by side; none fails the check: a tool that doesn’t answer reads as not installed.
cloud
The cloud accounts this computer’s cloud CLIs are signed in to, asked through those CLIs: whether a sign-in still reaches its provider (Failure with Refusal::CredentialsExpired when it ran out or is missing), who it is, and what the account offers: AWS’s profiles, its spend this month and whether it may create instances (aws), Azure’s subscriptions, the VM sizes a region offers a subscription and its core quotas (azure), Google Cloud’s billing accounts and organizations (gcp), and Oracle Cloud’s compartments and config file (oci).
docker
The Docker-compatible engines this computer has: each CLI context with an engine behind it, whether its daemon answers, which one the CLI uses, and pointing the CLI at another (docker context use). Every call is the Docker CLI’s, through the Context’s runner.
failure
Why a tool asked a question gave no usable answer: it isn’t installed, it gave no answer in time, it couldn’t be started, it answered and refused (and how, read from its words), or it answered something that can’t be read. Each has a code of the runner’s (Failure::code), so a refused sign-in is ErrorCode::CredentialsExpired here as it is on a run’s step.
host
This computer as machine setup reads it: its OS, its CPU and its package manager, each a closed set, and the files detection reads (KVM’s device, UTM’s bundle, the kernel’s module list…). It is worked out once (Host::here) and handed to every rule that depends on it. A rule matches on these enums (the OS and CPU are the runner’s HostOs and Arch), never on std::env::consts strings: an OS, CPU or package manager added is a compile error at every rule that doesn’t say what it does there yet.
install
Installing and removing the tools a computer runs projects with: the container engine, Vagrant, Terraform, the hypervisors, the cloud CLIs and the services they need. Each tool’s row (Dependency::row) says where it exists and what proves it installed; its install and its removal are one exhaustive match per OS over the tool and the package manager, so a tool, an OS or a package manager added is a compile error until each says what it does there. Every plan is built on any OS, so the tests read every row.
net
This computer’s network, as a caller needs it before it acts: whether a host port is free (port_free) and, when it isn’t, which process holds it (port_holder), and its public IPv4 address, as the internet sees it (public_ipv4): what a cloud firewall opens to when it lets this computer alone in. Independent services, run by different companies, are asked at once (curl, through the Context’s runner), and two must give the same address: one that is down or blocked fails nothing, and one that answers wrong (a captive portal’s page, a compromised service) can’t open a firewall to someone else.
place
The servers a computer places machines on, checked before anything is placed there: whether the server answers at all (reach, a TCP connection and how long it took), and what it answers as: a Proxmox VE API that accepts a sign-in and has the nodes, storages and bridges a placement needs (proxmox), an ESXi host’s SSH (esxi).
providers
The Vagrant providers (hypervisors) this computer can drive, and detecting which are usable. Vagrant abstracts the hypervisor; this detects what is installed here, what is still missing for Vagrant to drive it (Need), and when it can’t run VMs yet, why (Unavailable, a code a UI translates), and right before a start whether it is ready now (ready: UTM open and answering, QEMU’s emulator for a foreign CPU).
requirements
What a run needs on this computer, and what of it is missing here, with the plan that brings it.
selftest
Self-tests: proof that this computer runs deployments, not only that its tools are there. Each runs a throwaway deployment through a runner of its own (its home in the test’s folder, so nothing of it reaches a caller’s runner), says each step as it goes, and always takes the deployment down. What a test downloads is handed back, for a caller that keeps a record of its downloads. A step’s reason is the tool’s or the runner’s text; the UI words the steps.
setup
A guided setup of this computer: what to install, start or restart, in which order, for the kinds of project wanted (containers, VMs), with which engine and which hypervisor. The one place these rules live:
terminal
Opening a command in this computer’s own terminal, in a window of its own titled as the caller says: Terminal on macOS (osascript), the first terminal emulator that starts on Linux, a console window on Windows (cmd /c start). The command is a ShellCommand (a console the runner built, or the caller’s own), run in its folder with its variables, quoted so its words reach it as they are: a folder with a space, a ', or a Windows profile folder with &.
tools
The command-line tools a machine check reports: whether each answers its version probe, and the version it printed. A tool that can’t be started, fails its probe or runs out of the probe’s time reads as not installed, with no version: the check goes on, it never fails for one tool.
wsl
Whether WSL 2 is ready on a Windows computer.

Structs§

Context
What machine setup runs its tools on and reads.

Enums§

Arch
The OS and the CPU machine setup runs on: the runner’s (isothrum_runner::this_host, isothrum_runner::this_arch), written as the runner writes them (macos, amd64). A CPU architecture.
HostOs
The OS and the CPU machine setup runs on: the runner’s (isothrum_runner::this_host, isothrum_runner::this_arch), written as the runner writes them (macos, amd64). A host operating system.

Constants§

PROBE_TIMEOUT
How long a probe (VBoxManage --version, vagrant plugin list…) may take before it is dropped: a tool that started and ran out of it reads as installed and slow (a cold VBoxSVC), not as missing.