Documentation
¶
Overview ¶
Package preflight provides pre-flight validation for required binaries and system checks.
Index ¶
- Constants
- Variables
- func CheckAll() (warnings []string, errs []string)
- func CheckAllWithTimeout(timeout time.Duration) (warnings []string, errs []string)
- func IsBinaryAvailable(name string) bool
- func IsBinaryAvailableWithTimeout(name string, timeout time.Duration) bool
- type BinaryCheck
- func CheckBinaries() []BinaryCheck
- func CheckBinariesWithTimeout(timeout time.Duration) []BinaryCheck
- func CheckOptionalBinaries() []BinaryCheck
- func CheckOptionalBinariesWithTimeout(timeout time.Duration) []BinaryCheck
- func CheckRequiredBinaries() []BinaryCheck
- func CheckRequiredBinariesWithTimeout(timeout time.Duration) []BinaryCheck
- func GetAllBinaries() []BinaryCheck
- func GetOptionalBinaries() []BinaryCheck
- func GetRequiredBinaries() []BinaryCheck
- type SSHKeyPermResult
Constants ¶
const DefaultLookPathTimeout = 5 * time.Second
DefaultLookPathTimeout is the default timeout for exec.LookPath operations.
Variables ¶
var ErrEmptyBinaryName = errors.New("empty binary name")
ErrEmptyBinaryName indicates an empty binary name was provided.
Functions ¶
func CheckAll ¶
CheckAll performs all pre-flight checks and returns warnings and errors. Errors are for missing required binaries, warnings are for missing optional binaries. Error messages include the underlying error details.
func CheckAllWithTimeout ¶
CheckAllWithTimeout performs all pre-flight checks with a custom timeout.
func IsBinaryAvailable ¶
IsBinaryAvailable checks if a specific binary is available in PATH. Returns false for empty binary names.
Types ¶
type BinaryCheck ¶
type BinaryCheck struct {
Name string
Required bool // false = warning only
InstallHint string // e.g., "brew install sops" or "https://..."
Error error // The underlying error from LookPath if lookup failed
}
BinaryCheck represents a required binary and its purpose.
func CheckBinaries ¶
func CheckBinaries() []BinaryCheck
CheckBinaries validates all required and optional binaries are available. Returns list of missing binaries with install hints and error details.
func CheckBinariesWithTimeout ¶
func CheckBinariesWithTimeout(timeout time.Duration) []BinaryCheck
CheckBinariesWithTimeout validates all binaries with a custom timeout.
func CheckOptionalBinaries ¶
func CheckOptionalBinaries() []BinaryCheck
CheckOptionalBinaries validates optional binaries and returns missing ones. Returns list of missing optional binaries with error details.
func CheckOptionalBinariesWithTimeout ¶
func CheckOptionalBinariesWithTimeout(timeout time.Duration) []BinaryCheck
CheckOptionalBinariesWithTimeout validates optional binaries with a custom timeout.
func CheckRequiredBinaries ¶
func CheckRequiredBinaries() []BinaryCheck
CheckRequiredBinaries validates only required binaries are available. Returns list of missing required binaries with error details.
func CheckRequiredBinariesWithTimeout ¶
func CheckRequiredBinariesWithTimeout(timeout time.Duration) []BinaryCheck
CheckRequiredBinariesWithTimeout validates required binaries with a custom timeout.
func GetAllBinaries ¶
func GetAllBinaries() []BinaryCheck
GetAllBinaries returns all configured binaries (required and optional).
func GetOptionalBinaries ¶
func GetOptionalBinaries() []BinaryCheck
GetOptionalBinaries returns only optional binaries.
func GetRequiredBinaries ¶
func GetRequiredBinaries() []BinaryCheck
GetRequiredBinaries returns only required binaries.
type SSHKeyPermResult ¶ added in v0.30.3
type SSHKeyPermResult struct {
// Path is the key file that was checked (empty if no key file was found).
Path string
// Mode is the actual permission bits of the key file.
Mode os.FileMode
// PermissionsChecked reports whether POSIX permission bits were validated.
// Windows uses ACLs instead, which this check does not inspect.
PermissionsChecked bool
// Err is non-nil when the key path cannot be used safely as a key file.
Err error
}
SSHKeyPermResult is the result of an SSH key permission check.
func CheckSSHKeyPermissions ¶ added in v0.30.3
func CheckSSHKeyPermissions() SSHKeyPermResult
CheckSSHKeyPermissions validates the explicit SSH key or the first usable conventional candidate. The key must be a non-empty regular file and, on POSIX systems, have safe permissions (0400 or 0600). An empty Path means no candidate was found; SSH auth may instead use an agent or an HTTPS URL.