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 = behavior.ErrUnsupported // 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 = behavior.ErrNotFound // 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 = behavior.ErrNotManaged // ErrNotInstalled means a program an operation depends on is absent, so the // operation cannot be carried out on this host at all. ErrNotInstalled = behavior.ErrNotInstalled // ErrInvalid means the host refuses the input, such as a path that is a // directory where the operation reads a file. ErrInvalid = behavior.ErrInvalid )
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. The values are internal/behavior's, which behaviors return, so the agent's fact providers under internal/provider/node and a behavior report the same error.
Functions ¶
This section is empty.
Types ¶
type FileState ¶ added in v0.3.0
type FileState interface {
KVGet(ctx context.Context, bucket string, key string) (jetstream.KeyValueEntry, error)
KVPut(ctx context.Context, bucket string, key string, value []byte) (uint64, error)
}
FileState reads and writes the record of each file that osapi deployed, in the file-state KV bucket. A provider that deploys files keeps one, with the name of the bucket. A *natsclient.Client is one.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package gohaitest builds a fake host for the tests of the providers that read through gohai: a filesystem with given files, and gohai's generated command runner, configured to answer given command lines.
|
Package gohaitest builds a fake host for the tests of the providers that read through gohai: a filesystem with given files, and gohai's generated command runner, configured to answer given command lines. |
|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
|
node
|
|
|
disk
Package disk reads the local disks of the host through gohai.
|
Package disk reads the local disks of the host through gohai. |
|
disk/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
host
Package host reads the facts of the host, such as its hostname, its OS and its uptime.
|
Package host reads the facts of the host, such as its hostname, its OS and its uptime. |
|
host/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
load
Package load reads the load averages of the host.
|
Package load reads the load averages of the host. |
|
load/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
memory
Package memory reads the memory of the host.
|
Package memory reads the memory of the host. |
|
memory/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |