Documentation
¶
Overview ¶
Package provider defines shared types for all provider implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupported means the operation is not supported on the current OS // family. The agent maps this to StatusSkipped instead of StatusFailed. ErrUnsupported = errors.New("operation not supported on this OS family") // ErrNotFound means the thing the request named is not on the host: a user, // a group, a service, a cron entry, a sysctl key, a package. ErrNotFound = errors.New("not found") // ErrNotManaged means the thing exists on the host but osapi did not deploy // it, so osapi will not change or remove it. Distinct from ErrNotFound // because the answer to the operator is different: the file is there, and // something else owns it. ErrNotManaged = errors.New("not managed by osapi") // ErrNotInstalled means a program an operation depends on is absent, so the // operation cannot be carried out on this host at all. ErrNotInstalled = errors.New("not installed") )
The causes a provider can report that the API answers differently. A provider returns one of these wrapped in an error that says which thing and where, and the agent turns it into a code on the response so the controller does not have to read the sentence back.
Anything else is a failure with no further meaning, which the API answers with 500. Adding a sentinel is how a new distinction reaches an HTTP status; it is never reached by matching on words.
Functions ¶
func WireProviderFacts ¶
WireProviderFacts sets the facts function on all providers that support it. Providers that embed FactsAware automatically satisfy FactsSetter.
Types ¶
type FactsAware ¶
type FactsAware struct {
// contains filtered or unexported fields
}
FactsAware provides facts access to providers via embedding. Embed this in any provider struct to gain access to agent facts:
type MyProvider struct {
provider.FactsAware
// ... other fields
}
func (*FactsAware) Facts ¶
func (f *FactsAware) Facts() map[string]any
Facts returns the current agent facts, or nil if not available.
func (*FactsAware) SetFactsFunc ¶
func (f *FactsAware) SetFactsFunc( fn FactsFunc, )
SetFactsFunc sets the facts getter. Called after agent initialization to wire the provider to the agent's live facts.
type FactsFunc ¶
FactsFunc returns the current agent facts for use by providers. Called at execution time so providers always get the latest facts.
type FactsSetter ¶
type FactsSetter interface {
SetFactsFunc(fn FactsFunc)
}
FactsSetter is satisfied by any provider that embeds FactsAware. Used at wiring time to inject the facts function into all providers.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package command provides command execution capabilities.
|
Package command provides command execution capabilities. |
|
mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
container
|
|
|
docker
Package docker provides the Docker container management provider using the Docker Engine API.
|
Package docker provides the Docker container management provider using the Docker Engine API. |
|
docker/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
|
Package file implements file deploy and status operations using NATS Object Store for content and KV for state tracking.
|
Package file implements file deploy and status operations using NATS Object Store for content and KV for state tracking. |
|
mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
network
|
|
|
netinfo
Package netinfo provides network interface information.
|
Package netinfo provides network interface information. |
|
netinfo/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
netplan
Package netplan provides shared helpers for writing Netplan configuration files with validation, rollback, and file-state tracking.
|
Package netplan provides shared helpers for writing Netplan configuration files with validation, rollback, and file-state tracking. |
|
netplan/dns
Package dns provides DNS configuration management.
|
Package dns provides DNS configuration management. |
|
netplan/dns/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
netplan/iface
Package iface provides network interface configuration management via Netplan.
|
Package iface provides network interface configuration management via Netplan. |
|
netplan/iface/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
netplan/route
Package route provides network route configuration management via Netplan.
|
Package route provides network route configuration management via Netplan. |
|
netplan/route/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
ping
Package ping provides network ping functionality.
|
Package ping provides network ping functionality. |
|
ping/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
node
|
|
|
apt
Package apt provides package management operations via apt.
|
Package apt provides package management operations via apt. |
|
apt/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
certificate
Package certificate provides CA certificate management operations.
|
Package certificate provides CA certificate management operations. |
|
certificate/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
disk/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
host
Package host provides system host information.
|
Package host provides system host information. |
|
host/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
load
Package load provides system load average statistics.
|
Package load provides system load average statistics. |
|
load/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
log
Package log provides log viewing operations.
|
Package log provides log viewing operations. |
|
log/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
mem
Package mem provides memory usage statistics.
|
Package mem provides memory usage statistics. |
|
mem/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
ntp
Package ntp provides NTP server management via chrony.
|
Package ntp provides NTP server management via chrony. |
|
ntp/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
power
Package power provides power management operations (reboot, shutdown).
|
Package power provides power management operations (reboot, shutdown). |
|
power/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
process
Package process provides process management operations.
|
Package process provides process management operations. |
|
process/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
service
Package service provides systemd service management operations.
|
Package service provides systemd service management operations. |
|
service/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
sysctl
Package sysctl provides kernel parameter management via /etc/sysctl.d/.
|
Package sysctl provides kernel parameter management via /etc/sysctl.d/. |
|
sysctl/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
timezone
Package timezone provides system timezone management via timedatectl.
|
Package timezone provides system timezone management via timedatectl. |
|
timezone/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
user
Package user provides user and group management operations.
|
Package user provides user and group management operations. |
|
user/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
scheduled
|
|
|
cron
Package cron provides management of cron drop-in files and periodic scripts.
|
Package cron provides management of cron drop-in files and periodic scripts. |
|
cron/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |