Documentation
¶
Overview ¶
Package commands lets a worker's operator say where a command a job runs really lives.
An OpenJD template names the program it runs ("nuke", "blender"). Nothing guarantees that name exists on a host: Nuke installs as Nuke17.1.exe, and a shell alias is invisible because the worker starts commands directly, with no shell. The operator's worker.commands table closes that gap. It maps a command name to the executable to run in its place, with optional leading arguments (for example Nuke's --nc flag for a non-commercial license).
The table is operator configuration, never job input, so a job cannot use it to reach anything it could not already name. The package is stdlib-only: it is imported by the config loader, the session manager and the executor.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
// Path is the executable to run: an absolute path, or a bare name the
// worker's own PATH resolves when the process starts.
Path string `yaml:"path"`
// Args go before the arguments the job supplies. They are literal: no
// format-string expansion.
Args []string `yaml:"args"`
}
Command is what a command name resolves to.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver applies a Table. The zero value and nil resolve nothing.
func NewResolver ¶
NewResolver returns a Resolver for t on this host. t is not copied; the caller must not change it afterwards.
func (*Resolver) Resolve ¶
Resolve returns what to run for command and the arguments to run it with. A name with no entry is returned unchanged. A mapped name runs the entry's Path, with the entry's Args before args. The returned slice is always the caller's to keep: it never aliases args or the table.
type Table ¶
Table maps a command name, as a job writes it, to what to run instead.
func (Table) Contains ¶
Contains reports whether name has an entry, by this host's name rules: exact on POSIX, case-insensitive on Windows. It is the same question Resolve asks, so a caller deciding whether to add a default does not add one the table would already answer.