Documentation
¶
Overview ¶
Package executor provides SSH-based execution of Software Delivery template actions against managed remote servers.
The SSHExecutor is the sole concrete implementation of software.ComponentExecutor for server-target components. All placeholder substitution has already been applied to the ResolvedTemplate by the catalog loader; this package only interprets strategy strings and runs the resulting shell commands over SSH.
Index ¶
- type LocalExecutor
- func (e *LocalExecutor) Detect(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.DetectionResult, error)
- func (e *LocalExecutor) Install(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *LocalExecutor) Reinstall(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *LocalExecutor) Restart(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *LocalExecutor) RunPreflight(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.TargetReadinessResult, error)
- func (e *LocalExecutor) Start(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *LocalExecutor) Stop(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *LocalExecutor) Uninstall(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *LocalExecutor) Upgrade(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *LocalExecutor) Verify(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- type SSHExecutor
- func (e *SSHExecutor) Close()
- func (e *SSHExecutor) Detect(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.DetectionResult, error)
- func (e *SSHExecutor) Install(ctx context.Context, serverID string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *SSHExecutor) Reinstall(ctx context.Context, serverID string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *SSHExecutor) Restart(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *SSHExecutor) RunPreflight(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.TargetReadinessResult, error)
- func (e *SSHExecutor) SetOutputLogger(logger func(string))
- func (e *SSHExecutor) Start(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *SSHExecutor) Stop(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *SSHExecutor) Uninstall(ctx context.Context, serverID string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *SSHExecutor) Upgrade(ctx context.Context, serverID string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
- func (e *SSHExecutor) Verify(ctx context.Context, serverID string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalExecutor ¶
type LocalExecutor struct{}
LocalExecutor implements software.ComponentExecutor for AppOS-local components. Local components are read-mostly inventory entries; install and upgrade remain unsupported.
func NewLocalExecutor ¶
func NewLocalExecutor(_ core.App) (*LocalExecutor, error)
func (*LocalExecutor) Detect ¶
func (e *LocalExecutor) Detect(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.DetectionResult, error)
func (*LocalExecutor) Install ¶
func (e *LocalExecutor) Install(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
func (*LocalExecutor) Reinstall ¶
func (e *LocalExecutor) Reinstall(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
func (*LocalExecutor) Restart ¶
func (e *LocalExecutor) Restart(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
func (*LocalExecutor) RunPreflight ¶
func (e *LocalExecutor) RunPreflight(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.TargetReadinessResult, error)
func (*LocalExecutor) Start ¶
func (e *LocalExecutor) Start(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
func (*LocalExecutor) Stop ¶
func (e *LocalExecutor) Stop(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
func (*LocalExecutor) Uninstall ¶
func (e *LocalExecutor) Uninstall(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
func (*LocalExecutor) Upgrade ¶
func (e *LocalExecutor) Upgrade(_ context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
func (*LocalExecutor) Verify ¶
func (e *LocalExecutor) Verify(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
type SSHExecutor ¶
type SSHExecutor struct {
// contains filtered or unexported fields
}
SSHExecutor implements software.ComponentExecutor against a remote server via SSH. It holds a single persistent SSH client connection that is reused for all commands, avoiding per-command TCP+SSH handshake overhead. It is created once per operation scope and is not safe for concurrent use.
func NewSSHExecutor ¶
func NewSSHExecutor(app core.App, serverID, userID string) (*SSHExecutor, error)
NewSSHExecutor resolves the SSH configuration for serverID and establishes the underlying SSH connection. All subsequent commands reuse this single connection. userID may be empty; in that case the system account credential flow is used.
func (*SSHExecutor) Close ¶
func (e *SSHExecutor) Close()
Close releases the underlying SSH client connection if one was established. Safe to call on a nil receiver.
func (*SSHExecutor) Detect ¶
func (e *SSHExecutor) Detect(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.DetectionResult, error)
Detect checks whether the component binary is present and returns the detected version. installed_hint commands are tried in order; the first successful output determines installed state. version_command is run only when the component is detected as installed.
func (*SSHExecutor) Install ¶
func (e *SSHExecutor) Install(ctx context.Context, serverID string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
Install executes the install step defined by the template strategy. Supported strategies: "package" (apt-get), "script" (managed script). An empty strategy means the component is not installable via Software Delivery.
func (*SSHExecutor) Reinstall ¶
func (e *SSHExecutor) Reinstall(ctx context.Context, serverID string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
Reinstall re-executes the primary reinstall step.
func (*SSHExecutor) Restart ¶
func (e *SSHExecutor) Restart(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
func (*SSHExecutor) RunPreflight ¶
func (e *SSHExecutor) RunPreflight(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.TargetReadinessResult, error)
RunPreflight evaluates OS support, root privilege, and network availability against the template's PreflightSpec.
func (*SSHExecutor) SetOutputLogger ¶
func (e *SSHExecutor) SetOutputLogger(logger func(string))
SetOutputLogger attaches a best-effort line logger for long-running command output.
func (*SSHExecutor) Start ¶
func (e *SSHExecutor) Start(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
func (*SSHExecutor) Stop ¶
func (e *SSHExecutor) Stop(ctx context.Context, _ string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
func (*SSHExecutor) Uninstall ¶
func (e *SSHExecutor) Uninstall(ctx context.Context, serverID string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
Uninstall executes the uninstall step defined by the template strategy. Supported strategies: "package" (apt-get remove), "script" (managed script with args).
func (*SSHExecutor) Upgrade ¶
func (e *SSHExecutor) Upgrade(ctx context.Context, serverID string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
Upgrade executes the upgrade step defined by the template strategy. Supported strategies: "package" (apt-get --only-upgrade), "script" (managed script with args).
func (*SSHExecutor) Verify ¶
func (e *SSHExecutor) Verify(ctx context.Context, serverID string, tpl software.ResolvedTemplate) (software.SoftwareComponentDetail, error)
Verify checks the component's current state using the template's verify strategy. Only "systemd" strategy is supported for server-target components.