osmodule

package
v0.4.74 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 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 osmodule reads the manifest of a ReCasaOS module: a component that is installed on its own (a service of its own, packages of its own) and that the core shows only when it is there. The manifest ships in the release archive of the module, and the installer copies it to /etc/casaos/modules/<name>.json.

The file is data that the core can trust only as far as it validates it. Every name, unit, path and number in it is checked against a fixed pattern, an unknown field is an error, and nothing in it is ever run as a command, interpolated into a shell or opened as a path outside what the pattern allows: a manifest that does not pass is a module that cannot be told, and the core says so instead of guessing.

Index

Constants

View Source
const (
	ReasonUnreadable = "unreadable"
	ReasonTooLarge   = "too_large"
	ReasonFile       = "file_name"
	ReasonSchema     = "schema"
	ReasonValue      = "value"
	ReasonMissing    = "missing"
	ReasonTooMany    = "too_many"
)

the reasons of an Invalid

View Source
const MaxBytes = 64 << 10

MaxBytes is the most of a manifest that is read.

View Source
const Schema = 1

Schema is the one version of the manifest that is read: a change of the format is a new number, so that it is never guessed at.

Variables

This section is empty.

Functions

func FileName

func FileName(name string) string

FileName is the name of the file of a module.

Types

type Invalid

type Invalid struct {
	Field  string
	Reason string
}

An Invalid is why a manifest was not taken: the field that is wrong (a path through the manifest, from a fixed alphabet) and a code.

func (*Invalid) Error

func (e *Invalid) Error() string

type Maintenance

type Maintenance struct {
	Prepare string `json:"prepare"`
	Status  string `json:"status"`
	Resume  string `json:"resume"`
}

Maintenance are the three calls: prepare (POST, idempotent) asks the module to get ready, status says whether it is, and resume is made once the unit is back after the restart and the module has checked what it depends on.

type Manifest

type Manifest struct {
	Schema int `json:"schema"`
	// Name is the short name of the module ("virt"): the name of its file, and what the core calls it.
	Name  string `json:"name"`
	Title string `json:"title"`
	// Component is the name of the component that is released (the repository), Unit its systemd unit, GatewayRoute where the gateway reaches it.
	Component    string   `json:"component"`
	Unit         string   `json:"unit"`
	GatewayRoute string   `json:"gateway_route"`
	Packages     Packages `json:"packages"`
	// MinReCasaOS is the oldest release of ReCasaOS that the module works with; OS the operating systems it supports ("debian:12", "ubuntu:24.04").
	MinReCasaOS string   `json:"min_recasaos"`
	OS          []string `json:"os"`
	// OSUpgrade is what the module needs around an upgrade of the operating system; a module that does not say is one that the upgrade refuses.
	OSUpgrade *OSUpgrade `json:"os_upgrade,omitempty"`
}

A Manifest is what a module says of itself.

func Parse

func Parse(file string, raw []byte) (Manifest, error)

Parse reads the manifest that is in the file named file (the base name, "virt.json") and checks everything in it. The name inside must be the name of the file.

type OSUpgrade

type OSUpgrade struct {
	StopUnits          []string    `json:"stop_units"`
	StopTimeoutSeconds int         `json:"stop_timeout_seconds"`
	Maintenance        Maintenance `json:"maintenance"`
}

An OSUpgrade is what the core does around an upgrade of the operating system, declared and never scripted: the units it stops (after the module has said that it is ready), how long it waits for that, and three paths of the module's own API that it calls through the gateway with the internal secret.

type Packages

type Packages struct {
	Common []string `json:"common,omitempty"`
	AMD64  []string `json:"amd64,omitempty"`
	ARM64  []string `json:"arm64,omitempty"`
}

Packages are the packages of the operating system that the module needs, for every architecture and for each.

Jump to

Keyboard shortcuts

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