ctlcmd

package
v0.0.0-...-f5298d3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: GPL-3.0 Imports: 51 Imported by: 31

Documentation

Overview

Package ctlcmd contains the various snapctl subcommands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(context *hookstate.Context, args []string, uid uint32, features []string) (stdout, stderr []byte, err error)

Run runs the requested command.

Types

type ChangeInfo

type ChangeInfo struct {
	ID      string     `json:"id"`
	Kind    string     `json:"kind"`
	Summary string     `json:"summary"`
	Status  string     `json:"status"`
	Tasks   []TaskInfo `json:"tasks,omitempty"`
	Ready   bool       `json:"ready"`
	Err     string     `json:"err,omitempty"`

	SpawnTime time.Time  `json:"spawn-time,omitzero"`
	ReadyTime *time.Time `json:"ready-time,omitempty"`

	Data map[string]*json.RawMessage `json:"data,omitempty"`
}

ChangeInfo represents the information about a change that is needed for JSON marshaling.

func StateChangeToChangeInfo

func StateChangeToChangeInfo(chg *state.Change) *ChangeInfo

StateChangeToChangeInfo converts a state.Change to a ChangeInfo struct which has all the exported fields needed for JSON marshaling for `snap tasks` output. It also extracts the "api-data" from the change and includes it in the ChangeInfo.Data field.

type ForbiddenCommandError

type ForbiddenCommandError struct {
	Message string
}

ForbiddenCommandError conveys that a command cannot be invoked in some context

func (ForbiddenCommandError) Error

func (f ForbiddenCommandError) Error() string

type KModInsertCmd

type KModInsertCmd struct {
	Positional struct {
		Module  string   `positional-arg-name:"<module>" required:"yes" description:"kernel module name"`
		Options []string `positional-arg-name:"<options>" description:"kernel module options"`
	} `positional-args:"yes" required:"yes"`
	// contains filtered or unexported fields
}

func (*KModInsertCmd) Execute

func (k *KModInsertCmd) Execute([]string) error

type KModRemoveCmd

type KModRemoveCmd struct {
	Positional struct {
		Module string `positional-arg-name:"<module>" required:"yes" description:"kernel module name"`
	} `positional-args:"yes" required:"yes"`
	// contains filtered or unexported fields
}

func (*KModRemoveCmd) Execute

func (k *KModRemoveCmd) Execute([]string) error

type MissingContextError

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

func (*MissingContextError) Error

func (e *MissingContextError) Error() string

type NoAttributeError

type NoAttributeError struct {
	Attribute string
}

NoAttributeError indicates that an interface attribute is not set.

func (*NoAttributeError) Error

func (e *NoAttributeError) Error() string

type TaskInfo

type TaskInfo struct {
	ID       string              `json:"id"`
	Kind     string              `json:"kind"`
	Summary  string              `json:"summary"`
	Status   string              `json:"status"`
	Log      []string            `json:"log,omitempty"`
	Progress client.TaskProgress `json:"progress"`

	SpawnTime time.Time  `json:"spawn-time,omitzero"`
	ReadyTime *time.Time `json:"ready-time,omitempty"`

	Data map[string]*json.RawMessage `json:"data,omitempty"`
}

TaskInfo represents the information about a task that is needed for JSON marshaling for `snap tasks` output.

type UnsuccessfulError

type UnsuccessfulError struct {
	ExitCode int
}

UnsuccessfulError carries a specific exit code to be returned to the client.

func (UnsuccessfulError) Error

func (e UnsuccessfulError) Error() string

Jump to

Keyboard shortcuts

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