script

package
v1.77.0 Latest Latest
Warning

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

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

Documentation

Overview

Package script models a module's enabled script as a scheduler rule. A module may ship an `enabled` shell script that inspects the values of the already-enabled modules and reports whether this module should run. Its true result is a soft Enable vote and its false result a hard Forbid; a script that cannot be evaluated also forbids the module, so a broken script never leaves a module running by default.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Descriptor

type Descriptor struct {
	Path     string
	Settings addonutils.Values
	Values   addonutils.Values
}

Descriptor describes a module's enabled script and the values handed to it. Values carries the global block (including the enabledModules list) the script reads; Settings carries the module's own config values.

type Package

type Package interface {
	// GetEnabledScriptDescriptor returns the module's enabled script descriptor, or nil when the
	// module ships none.
	GetEnabledScriptDescriptor() *Descriptor
}

Package is the slice of a module this rule inspects: its enabled script, if any.

type Rule

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

Rule is driven by a module's enabled script: a true result votes to enable the module (a soft Enable), a false result vetoes it (Forbid), and a script that cannot be evaluated also vetoes it.

func NewRule

func NewRule(pkg Package, logger *log.Logger) *Rule

NewRule constructs a Rule that evaluates the given package's enabled script.

func (*Rule) Decide

func (r *Rule) Decide() rule.Decision

Decide runs the module's enabled script and folds its outcome onto the rule lattice: a missing script is no opinion (Undefined); a true result is a soft Enable vote; a false result vetoes the module (Forbid); a failure to run or parse the script also vetoes it, so a broken script cannot leave a module running by default. The rule.Rule interface carries no context and one must not be stored on the Rule, so the script runs under context.Background.

Jump to

Keyboard shortcuts

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