uninstall

package
v0.7.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const SystemdUnitName = "kukeond.service"

SystemdUnitName is the canonical short name the systemctl verbs accept.

View Source
const SystemdUnitPath = "/etc/systemd/system/kukeond.service"

SystemdUnitPath is the absolute path of the kukeond systemd unit scripts/install.sh writes. Exported so the test package can match against it without re-spelling the literal.

Variables

View Source
var ErrAborted = errors.New("uninstall aborted")

ErrAborted is returned when the interactive confirmation prompt receives any answer other than "yes"/"y". It signals a clean abort to cobra so the process exits non-zero, matching the documented invariant in docs/cli-use-cases.md § "Full per-host teardown" (EOF or non-`yes` answer aborts with non-zero exit and no destructive side effect).

Functions

func NewUninstallCmd

func NewUninstallCmd() *cobra.Command

Types

type MockControllerKey

type MockControllerKey struct{}

MockControllerKey injects a mock controller via cmd.Context() for tests.

type MockSystemdRemoverKey added in v0.6.0

type MockSystemdRemoverKey struct{}

MockSystemdRemoverKey injects a SystemdRemover via cmd.Context() for tests in the same package layout as MockControllerKey.

type SystemdRemovalReport added in v0.6.0

type SystemdRemovalReport struct {
	// Skipped is true when the helper short-circuited without touching the
	// host (no systemctl in PATH, or no unit file). SkipReason names the
	// branch so the printed report is self-explanatory.
	Skipped    bool
	SkipReason string
	// UnitPath is the absolute unit file path the helper attempted to
	// disable; carried in the report so a future change to SystemdUnitPath
	// does not require chasing the renderer to update its hard-coded text.
	UnitPath string
	// Stopped/Disabled/FileRemoved/DaemonReloaded each flip true on success
	// of the corresponding sub-step. Stop / disable / daemon-reload are
	// best-effort — the binding step is FileRemoved. The fields are
	// independent so the renderer can show (e.g.) "stop+disable failed
	// (no systemd PID 1) but file removed" on partial paths.
	Stopped        bool
	Disabled       bool
	FileRemoved    bool
	DaemonReloaded bool
	// Err carries the first non-nil binding-step error so runUninstall can
	// propagate a non-zero exit. Best-effort sub-steps (stop / disable /
	// daemon-reload) do not populate Err — their outcomes are visible via
	// their bool fields. The report is still returned in full on error so
	// the operator sees what did succeed before the failure.
	Err error
}

SystemdRemovalReport summarizes what removeKukeondSystemdUnit did. Every field is independently surfaced in the CLI report so the operator can tell which sub-step ran on a partially-supervised host (e.g., systemctl present but the unit was hand-deleted before re-running uninstall).

type SystemdRemover added in v0.6.0

type SystemdRemover func(ctx context.Context) SystemdRemovalReport

SystemdRemover is the contract removeKukeondSystemdUnit and any test substitute satisfy. Injected via MockSystemdRemoverKey so tests need not touch the host's systemctl or /etc/systemd/system.

Jump to

Keyboard shortcuts

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