os

package
v1.3.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package os is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectMode added in v1.3.0

func DetectMode(lookPath func(string) (string, error)) v1beta1.OsModeType

DetectMode determines the OS management mode by checking for image management binaries on PATH. If bootc or rpm-ostree is available, the mode is "image"; otherwise it is "package".

lookPath should be exec.LookPath in production. Accepting it as a parameter enables deterministic unit testing without PATH manipulation.

DetectMode and NewClient both check binary availability but via separate mechanisms — DetectMode uses the caller-supplied lookPath while NewClient uses isBinaryAvailable (os/exec.LookPath directly). Both run sequentially at startup in agent.go, so PATH cannot change between the two calls.

Types

type Client

type Client interface {
	// Status retrieves the current OS status
	Status(ctx context.Context) (*Status, error)
	// Switch prepares the system to switch to the specified OS image
	Switch(ctx context.Context, image string) error
	// Rollback stages the previous deployment and reboots into it
	Rollback(ctx context.Context) error
	// Apply applies the OS changes, potentially triggering a reboot
	Apply(ctx context.Context) error
}

func NewClient

func NewClient(log *log.PrefixLogger, exec executer.Executer) Client

type Manager

type Manager interface {
	BeforeUpdate(ctx context.Context, current, desired *v1beta1.DeviceSpec) error
	AfterUpdate(ctx context.Context, desired *v1beta1.DeviceSpec) error
	// Rollback validates that the rollback deployment matches the expected image
	// from the spec, then stages the previous deployment and reboots into it.
	Rollback(ctx context.Context, desired *v1beta1.DeviceSpec) error
	Reboot(ctx context.Context, desired *v1beta1.DeviceSpec) error

	dependency.OCICollector
	status.Exporter
}

func NewManager

func NewManager(
	log *log.PrefixLogger,
	client Client,
	osMode v1beta1.OsModeType,
	readWriter fileio.ReadWriter,
	podmanClient *client.Podman,
	pullConfigResolver dependency.PullConfigResolver,
) Manager

NewManager creates a new OS manager.

type MockClient

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

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) Apply

func (m *MockClient) Apply(ctx context.Context) error

Apply mocks base method.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) Rollback added in v1.2.0

func (m *MockClient) Rollback(ctx context.Context) error

Rollback mocks base method.

func (*MockClient) Status

func (m *MockClient) Status(ctx context.Context) (*Status, error)

Status mocks base method.

func (*MockClient) Switch

func (m *MockClient) Switch(ctx context.Context, image string) error

Switch mocks base method.

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) Apply

func (mr *MockClientMockRecorder) Apply(ctx any) *gomock.Call

Apply indicates an expected call of Apply.

func (*MockClientMockRecorder) Rollback added in v1.2.0

func (mr *MockClientMockRecorder) Rollback(ctx any) *gomock.Call

Rollback indicates an expected call of Rollback.

func (*MockClientMockRecorder) Status

func (mr *MockClientMockRecorder) Status(ctx any) *gomock.Call

Status indicates an expected call of Status.

func (*MockClientMockRecorder) Switch

func (mr *MockClientMockRecorder) Switch(ctx, image any) *gomock.Call

Switch indicates an expected call of Switch.

type MockManager

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

MockManager is a mock of Manager interface.

func NewMockManager

func NewMockManager(ctrl *gomock.Controller) *MockManager

NewMockManager creates a new mock instance.

func (*MockManager) AfterUpdate

func (m *MockManager) AfterUpdate(ctx context.Context, desired *v1beta1.DeviceSpec) error

AfterUpdate mocks base method.

func (*MockManager) BeforeUpdate

func (m *MockManager) BeforeUpdate(ctx context.Context, current, desired *v1beta1.DeviceSpec) error

BeforeUpdate mocks base method.

func (*MockManager) CollectOCITargets added in v0.9.0

func (m *MockManager) CollectOCITargets(ctx context.Context, current, desired *v1beta1.DeviceSpec, opts ...dependency.OCICollectOpt) (*dependency.OCICollection, error)

CollectOCITargets mocks base method.

func (*MockManager) EXPECT

func (m *MockManager) EXPECT() *MockManagerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockManager) Reboot

func (m *MockManager) Reboot(ctx context.Context, desired *v1beta1.DeviceSpec) error

Reboot mocks base method.

func (*MockManager) Rollback added in v1.2.0

func (m *MockManager) Rollback(ctx context.Context, desired *v1beta1.DeviceSpec) error

Rollback mocks base method.

func (*MockManager) Status

func (m *MockManager) Status(arg0 context.Context, arg1 *v1beta1.DeviceStatus, arg2 ...status.CollectorOpt) error

Status mocks base method.

type MockManagerMockRecorder

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

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) AfterUpdate

func (mr *MockManagerMockRecorder) AfterUpdate(ctx, desired any) *gomock.Call

AfterUpdate indicates an expected call of AfterUpdate.

func (*MockManagerMockRecorder) BeforeUpdate

func (mr *MockManagerMockRecorder) BeforeUpdate(ctx, current, desired any) *gomock.Call

BeforeUpdate indicates an expected call of BeforeUpdate.

func (*MockManagerMockRecorder) CollectOCITargets added in v0.9.0

func (mr *MockManagerMockRecorder) CollectOCITargets(ctx, current, desired any, opts ...any) *gomock.Call

CollectOCITargets indicates an expected call of CollectOCITargets.

func (*MockManagerMockRecorder) Reboot

func (mr *MockManagerMockRecorder) Reboot(ctx, desired any) *gomock.Call

Reboot indicates an expected call of Reboot.

func (*MockManagerMockRecorder) Rollback added in v1.2.0

func (mr *MockManagerMockRecorder) Rollback(ctx, desired any) *gomock.Call

Rollback indicates an expected call of Rollback.

func (*MockManagerMockRecorder) Status

func (mr *MockManagerMockRecorder) Status(arg0, arg1 any, arg2 ...any) *gomock.Call

Status indicates an expected call of Status.

type Status

type Status struct {
	container.BootcHost
}

Jump to

Keyboard shortcuts

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