osupdate

package
v0.1.85 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0 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

Overview

Package osupdate reads the package and kernel state already present on an apt host. It never refreshes package lists and its only apt invocation is a simulation.

Index

Constants

View Source
const (
	FingerprintInterval = 5 * time.Minute
	FullReadInterval    = 6 * time.Hour
)
View Source
const Capability = "os-status/1"

Capability advertises the read-only OS snapshot stream of step S1. It is deliberately not "os-update/1": that name is reserved for the write steps, so an agent of this build is never taken for one that can change the operating system.

Variables

This section is empty.

Functions

func CanAdvertiseCapability

func CanAdvertiseCapability(goos string, uid int, underSystemd, hasSystemdRun bool) bool

CanAdvertiseCapability is the pure part of capability detection, exposed for platform-matrix tests.

func CapabilityAvailable

func CapabilityAvailable() bool

CapabilityAvailable is deliberately strict: S1 reads are offered only from the supported root systemd agent unit.

func IsRoot

func IsRoot() bool

IsRoot reports whether the current process has the privileges required for panel-host reads in v1.

Types

type Monitor

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

Monitor runs the expensive read only when apt/dpkg/boot inputs change, and at least every six hours. Fingerprinting itself is filesystem metadata only.

func NewMonitor

func NewMonitor(reader *Reader) *Monitor

func (*Monitor) Poll

func (m *Monitor) Poll(ctx context.Context, force bool) (*agentv1.OsStatus, bool, bool, error)

Poll checks filesystem metadata and reads only when forced, changed, or six hours have passed. It returns the newest result, whether the public snapshot changed, and whether a full read ran.

func (*Monitor) Run

func (m *Monitor) Run(ctx context.Context, onChange func(*agentv1.OsStatus))

Run keeps the panel-host snapshot current. It does not call out to a node or refresh package lists.

func (*Monitor) Snapshot

func (m *Monitor) Snapshot() *agentv1.OsStatus

Snapshot returns the latest completed result; it never starts a read.

type Reader

type Reader struct {
	Root string
	Run  Runner
	Now  func() time.Time
}

Reader inspects the host. Root is a test-only filesystem root; commands should be replaced when it is set.

func NewReader

func NewReader() *Reader

func (*Reader) Read

func (r *Reader) Read(ctx context.Context) (*agentv1.OsStatus, error)

Read creates a fresh snapshot. Package lists are only read; no apt-get update or other network command is run.

type Runner

type Runner func(context.Context, string, ...string) ([]byte, error)

Runner executes one local command and returns its combined output. Tests replace it with fixture-backed responses.

Jump to

Keyboard shortcuts

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