report

package
v1.6.0 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: 7 Imported by: ? 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

Index

Constants

View Source
const (
	KindManagedInstall   = "managed_install"
	KindManagedUninstall = "managed_uninstall"
	KindManagedUpdate    = "managed_update"
	KindOptionalInstall  = "optional_install"
	KindDefaultInstall   = "default_install"
	KindUpdateFor        = "update_for"
)

Item kinds: where an item came from in the manifests.

View Source
const (
	StatusInstalled = "installed"
	StatusPending   = "pending"
	StatusFailed    = "failed"
	StatusDeferred  = "deferred"
	StatusRemoved   = "removed"
	StatusAvailable = "available"
)

Item statuses: what the run did, or would do, with an item.

View Source
const SchemaVersion = 1

SchemaVersion is the inventory schema version. Bump it on any change that renames, removes, or changes the meaning of a field.

Variables

This section is empty.

Functions

func WriteInventory

func WriteInventory(path string, inv Inventory) error

WriteInventory writes inv as indented JSON to path (see writeProtected).

Types

type DeferredItem

type DeferredItem struct {
	Name    string
	Version string
	Action  string
	Reason  string
}

DeferredItem records an item whose action was deferred (e.g. a blocking app was running) during this run

type FailedItem

type FailedItem struct {
	Name    string
	Version string
	Action  string
	Error   string
}

FailedItem records an item whose action failed during this run

type Inventory

type Inventory struct {
	SchemaVersion         int             `json:"schema_version"`
	ConsoleUser           string          `json:"ConsoleUser"`
	StartTime             string          `json:"StartTime"`
	EndTime               string          `json:"EndTime"`
	ManagedInstallVersion string          `json:"ManagedInstallVersion"`
	ManifestName          string          `json:"ManifestName"`
	Errors                []string        `json:"Errors"`
	Warnings              []string        `json:"Warnings"`
	ProblemInstalls       []InventoryItem `json:"ProblemInstalls"`
	ManagedInstalls       []InventoryItem `json:"ManagedInstalls"`
	InstalledItems        []string        `json:"InstalledItems"`
	RemovedItems          []string        `json:"RemovedItems"`
	ItemsToInstall        []InventoryItem `json:"ItemsToInstall"`
	ItemsToRemove         []InventoryItem `json:"ItemsToRemove"`
}

Inventory is the osquery-facing state of one managed run. It mirrors Munki's ManagedInstallReport keys so a sofcat_* table can reuse the macadmins munki table's structs with JSON in place of plist.

type InventoryItem

type InventoryItem struct {
	Name             string `json:"name"`
	DisplayName      string `json:"display_name"`
	Installed        bool   `json:"installed"`
	InstalledVersion string `json:"installed_version"`
	VersionToInstall string `json:"version_to_install"`
	Kind             string `json:"kind"`
	Status           string `json:"status"`
	SelfService      bool   `json:"self_service"`
	RequestedBy      string `json:"requested_by,omitempty"`
	DeferredReason   string `json:"deferred_reason,omitempty"`
	Error            string `json:"error,omitempty"`
}

InventoryItem is one item in the inventory. The first five keys are Munki's; the rest are SofCat extras.

type NoActionItem

type NoActionItem struct {
	Name    string
	Version string
	Action  string
}

NoActionItem records an item whose status check found nothing to do: an install or update already present, or an uninstall already absent

type Plan

type Plan struct {
	ConsoleUser           string
	ManifestName          string
	ManagedInstallVersion string
	StartTime             time.Time
	EndTime               time.Time
	CheckOnly             bool
	Errors                []string
	Warnings              []string
	Items                 []PlanItem
}

Plan is the caller's view of the run: its metadata and every item it considered. Items are listed in order; the first entry for a name wins.

type PlanItem

type PlanItem struct {
	Name        string
	DisplayName string
	Version     string
	Kind        string
	SelfService bool
	// RequestedBy is the user whose self-service request this run carries out,
	// "" for any other item.
	RequestedBy string
	// Installed is the caller's own status check. It is used only where the
	// run's results can't tell: unselected optional installs, and
	// managed_update items the run found nothing to do for (current or absent).
	Installed bool
}

PlanItem is one item the run considered, as the caller resolved it from the manifests and catalogs.

type Report

type Report struct {
	// InstalledItems contains a list of items we successfully installed
	InstalledItems []catalog.Item

	// UninstalledItems contains a list of items we successfully uninstalled
	UninstalledItems []catalog.Item

	// FailedItems contains a list of items whose actions failed
	FailedItems []FailedItem

	// DeferredItems contains a list of items whose actions were deferred
	DeferredItems []DeferredItem

	// NoActionItems contains a list of items whose status check found nothing to do
	NoActionItems []NoActionItem
}

Report holds the state of a single managed run (K7: no package globals)

func New

func New() *Report

New returns a fresh Report for one run

func (*Report) Inventory

func (r *Report) Inventory(p Plan) Inventory

Inventory builds the inventory from the plan and the run's real results.

Jump to

Keyboard shortcuts

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