Documentation
¶
Index ¶
- func Expand(manifests []Item, facts conditions.Facts) (effective []Item, held []Held)
- func GetCatalogs(cfg config.Configuration) (map[int]map[string]catalog.Item, error)
- func GetHarnesses(cfg config.Configuration) (harness.Table, error)
- func SaveSelfServe(path string, entry Item) error
- func SelfServePath(appDataPath string) string
- func UpdateSelfServe(path string, fn func(*Item) bool) error
- type ConditionalItem
- type Held
- type Item
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶ added in v1.11.0
func Expand(manifests []Item, facts conditions.Facts) (effective []Item, held []Held)
Expand resolves every manifest's conditional_items against facts. A true block's lists join its manifest's plain lists, so callers read only Installs, OptionalInstalls and the rest; a false block, or one whose condition cannot be evaluated, adds nothing; an unknown block is returned in held instead. The effective manifests carry no conditional_items. Every reader of manifest lists, the managed run and the service alike, must read Expand's output, or the list call and the run disagree.
func GetCatalogs ¶
GetCatalogs returns a map of `catalog.Item` from the catalogs and any fatal catalog-loading error. It lives on the agent side so pkg/catalog stays a dependency-free schema package.
func GetHarnesses ¶ added in v1.11.0
func GetHarnesses(cfg config.Configuration) (harness.Table, error)
GetHarnesses fetches and parses <url>harnesses.yaml, the repository's placement table. A repository without one (404) has an empty table: items that are not zip items do not need it, and zip items then fail because no placement is defined. Any other fetch or parse error fails like a catalog fetch error.
func SaveSelfServe ¶
SaveSelfServe persists the self-serve manifest at path. It keeps the three self-serve lists (managed_installs, managed_uninstalls, default_installs) and the selected_by record, and drops includes/catalogs/updates/conditional_items, which the self-serve file never owns.
func SelfServePath ¶
SelfServePath returns the path to the self-serve manifest under appDataPath.
func UpdateSelfServe ¶
UpdateSelfServe loads the self-serve manifest at path, lets fn change it, and saves it when fn reports a change, all under one in-process lock. CEILING: the lock is per process. The service owns the file and runs every managed run in-process; a separate `sofcat` CLI run racing the service could still lose a write. Upgrade to a file lock if both ever write concurrently.
Types ¶
type ConditionalItem ¶ added in v1.11.0
type ConditionalItem struct {
Condition string `yaml:"condition"`
Installs []string `yaml:"managed_installs"`
OptionalInstalls []string `yaml:"optional_installs"`
DefaultInstalls []string `yaml:"default_installs"`
Uninstalls []string `yaml:"managed_uninstalls"`
Updates []string `yaml:"managed_updates"`
ConditionalItems []ConditionalItem `yaml:"conditional_items"`
}
ConditionalItem is one conditional_items block: lists that apply only when its condition holds on this machine. Blocks nest.
type Held ¶ added in v1.11.0
Held is a conditional_items block whose condition is unknown on this machine: Items, every name under it including nested blocks, are neither added nor removed until Missing facts appear.
type Item ¶
type Item struct {
Name string `yaml:"name"`
Includes []string `yaml:"included_manifests"`
Installs []string `yaml:"managed_installs"`
OptionalInstalls []string `yaml:"optional_installs"`
DefaultInstalls []string `yaml:"default_installs"`
Uninstalls []string `yaml:"managed_uninstalls"`
Updates []string `yaml:"managed_updates"`
Catalogs []string `yaml:"catalogs"`
// ConditionalItems is resolved by Expand; read the lists of its output.
ConditionalItems []ConditionalItem `yaml:"conditional_items,omitempty"`
// SelectedBy is the self-serve file's record of who selected each item:
// item name to the caller's ID (a SID, or a uid in decimal). Only the
// self-serve file has it.
SelectedBy map[string]string `yaml:"selected_by,omitempty"`
}
Item represents a single object from the manifest
func Get ¶
func Get(cfg config.Configuration) (manifests []Item, newCatalogs []string, err error)
Get returns: 1) All manifest objects 2) Aditional catalogs that need to be added to the config 3) Any retrieval or parse error encountered while loading manifests
func LoadSelfServe ¶
LoadSelfServe reads the self-serve manifest at path. A missing file returns a named empty manifest rather than an error.