tools

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MPL-2.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseToolsManager

type BaseToolsManager struct {
	// contains filtered or unexported fields
}

BaseToolsManager is the base implementation of the ToolsManager interface.

func NewToolsManager

func NewToolsManager(configHandler config.ConfigHandler, shell shell.Shell) *BaseToolsManager

NewToolsManager creates a new ToolsManager instance with the given config handler and shell.

func (*BaseToolsManager) Check

func (t *BaseToolsManager) Check() error

Check verifies every tool that may be required for any windsor codepath. Equivalent to CheckRequirements(AllRequirements()) and exists for backward compatibility with the explicit "check everything" command (`windsor check`) and any caller that has not been migrated to declare per-command requirements.

func (*BaseToolsManager) CheckAuth added in v0.9.0

func (t *BaseToolsManager) CheckAuth() error

CheckAuth verifies the operator has the cloud CLIs for in-use platforms and that their credentials resolve. Called from terraform-touching command paths (bootstrap/up/apply/ plan/destroy) and `windsor check` — never from `init` or `env`.

func (*BaseToolsManager) CheckRequirements added in v0.9.0

func (t *BaseToolsManager) CheckRequirements(reqs Requirements) error

CheckRequirements runs each check that reqs requests and that the config also enables. A request that is too broad is harmless, because the config gate skips the binary check. A request that is too narrow is the risk, because an outdated tool can then reach the run. CheckAuth, not this method, checks the AWS CLI and the credentials. Commands such as windsor init and windsor env do not need the AWS CLI.

func (*BaseToolsManager) CheckTerraform added in v0.9.0

func (t *BaseToolsManager) CheckTerraform() error

CheckTerraform checks that the configured Terraform or OpenTofu command is on PATH. It also checks that the version meets the minimum. It is exported for callers that need Terraform when terraform.enabled is false, such as the module resolver of the composer, which runs terraform init.

func (*BaseToolsManager) GetTerraformCommand added in v0.9.0

func (t *BaseToolsManager) GetTerraformCommand() string

GetTerraformCommand returns the terraform command to use (terraform or tofu) based on configuration. Defaults to "terraform" if terraform.driver is not set in the context config. Accepts case-insensitive driver values and "tofu" as an alias for "opentofu".

func (*BaseToolsManager) Install

func (t *BaseToolsManager) Install() error

Install is a placeholder for the tool installation. It does nothing and returns nil.

type MockToolsManager

type MockToolsManager struct {
	InstallFunc             func() error
	CheckFunc               func() error
	CheckRequirementsFunc   func(reqs Requirements) error
	CheckAuthFunc           func() error
	CheckTerraformFunc      func() error
	GetTerraformCommandFunc func() string
}

MockToolsManager is a mock implementation of the ToolsManager interface for testing purposes.

func NewMockToolsManager

func NewMockToolsManager() *MockToolsManager

NewMockToolsManager creates a new instance of MockToolsManager.

func (*MockToolsManager) Check

func (m *MockToolsManager) Check() error

Check calls the mock CheckFunc if set, otherwise returns nil.

func (*MockToolsManager) CheckAuth added in v0.9.0

func (m *MockToolsManager) CheckAuth() error

CheckAuth calls the mock CheckAuthFunc if set, otherwise returns nil.

func (*MockToolsManager) CheckRequirements added in v0.9.0

func (m *MockToolsManager) CheckRequirements(reqs Requirements) error

CheckRequirements calls the mock CheckRequirementsFunc when set, falls back to CheckFunc when only the legacy hook is configured (so existing tests keep working without rewrites), and otherwise returns nil. This mirrors the production aliasing where Check() routes through CheckRequirements(AllRequirements()).

func (*MockToolsManager) CheckTerraform added in v0.9.0

func (m *MockToolsManager) CheckTerraform() error

CheckTerraform calls the mock CheckTerraformFunc if set, otherwise returns nil.

func (*MockToolsManager) GetTerraformCommand added in v0.9.0

func (m *MockToolsManager) GetTerraformCommand() string

GetTerraformCommand calls the mock GetTerraformCommandFunc if set, otherwise returns "terraform"

func (*MockToolsManager) Install

func (m *MockToolsManager) Install() error

InstallTools calls the mock InstallToolsFunc if set, otherwise returns nil.

type Requirements added in v0.9.0

type Requirements struct {
	Docker    bool
	Colima    bool
	Terraform bool
	Secrets   bool
	Kubelogin bool
}

Requirements is the set of tool families a single command's codepath will actually exercise. Each field is opt-in: a command requests only what it will run, and the corresponding check still respects the configHandler gates (e.g. Docker=true only triggers a docker check when docker.enabled is set or workstation.runtime is a docker-family driver). Over-requesting is safe — checks no-op when the underlying config gate is off; under-requesting is the bug to avoid because it lets a stale tool slip through to the actual command.

func AllRequirements added in v0.9.0

func AllRequirements() Requirements

AllRequirements returns a Requirements with every field true. Used by `windsor check` (the explicit "verify my whole setup" command) and as the default for code paths that must preserve historical Check() behavior.

type Shims added in v0.10.0

type Shims struct {
	shims.Shims
	LookPath func(file string) (string, error)
}

Shims holds the shared system call primitives and the tools-specific shims.

func NewShims added in v0.10.0

func NewShims() *Shims

NewShims returns a Shims with every field set to its real implementation.

type ToolsManager

type ToolsManager interface {
	Install() error
	Check() error
	CheckRequirements(reqs Requirements) error
	CheckAuth() error
	CheckTerraform() error
	GetTerraformCommand() string
}

ToolsManager checks that the tools and the cloud credentials of a Windsor command are ready.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL