cmdbase

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate added in v1.0.2

func Migrate() boa.CmdIfc

Migrate applies schema migrations (util.MigrateDatabase) and nothing else. Runtime commands connect with util.ConnectDatabase and must not call this as a side effect: migrating while factum2-web is serving will rewrite tables out from under the GUI. Stop the web process, run migrate, start it again. Uses Params (factum2.yaml with db:) even when the parent binary is otherwise a ParamsAgent API client.

func Run added in v1.0.4

func Run(c boa.CmdIfc)

Run executes a boa command without dumping cobra usage/help on error. boa.Cmd.Run always prints UsageString() before the error — including for runtime failures from RunFuncE — which dumps every config flag on crash. --help still works. Failures print "Error: ..." to stderr and exit 1.

func SetupCLI

func SetupCLI()

func SetupLog

func SetupLog(c CommonParams) error

func ShowConfig

func ShowConfig() boa.CmdIfc

func ShowConfigAgent

func ShowConfigAgent(fetchRemote ...func(*util.ConfigFactum) (any, error)) boa.CmdIfc

ShowConfigAgent is the show-config subcommand for binaries that embed ParamsAgent (factum/worker sections only) rather than the full Params - keeps show-config's required flags matching what the binary's other subcommands actually need.

fetchRemote is optional: services that pull their database-backed settings from the primary over REST (dns, icinga, librenms, oxidized, prometheus) pass their FetchRemoteConfig, and its result is printed after the local config. A fetch failure is logged and the command still exits 0 - show-config should always report what it can, even with the primary unreachable, rather than have the whole command fail from a single missing section.

Types

type CommonParams

type CommonParams struct {
	Debug    bool   `short:"d" optional:"true" descr:"Enable verbose debug logging" `
	Loglevel string `short:"l" descr:"Set log level" alts:"error,warn,info,debug" default:"info" strict:"true"`
}

type Params

type Params struct {
	ConfigFile string          `short:"f" configfile:"true" optional:"false" default:"/etc/factum2/factum2.yaml"`
	Config     util.ConfigRoot `yaml:",inline"`
	CommonParams
}

type ParamsAgent

type ParamsAgent struct {
	ConfigFile string               `short:"f" configfile:"true" optional:"false" default:"/etc/factum2/factum2-worker.yaml"`
	Config     util.ConfigAgentRoot `yaml:",inline"`
	CommonParams
}

Directories

Path Synopsis
factum2-icinga-notifications is the Icinga2 NotificationCommand invoked directly by icinga2 whenever a host/service alarm fires.
factum2-icinga-notifications is the Icinga2 NotificationCommand invoked directly by icinga2 whenever a host/service alarm fires.
Web backend for factumn2
Web backend for factumn2

Jump to

Keyboard shortcuts

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