Documentation
¶
Overview ¶
Package commoncmd provides utilities and shared functionality to facilitate operations related to managing remotes objects, nodes, and logs for omcmd and oxcmd.
Index ¶
- Constants
- Variables
- func APIKeywordItemsToRaw(items api.KeywordItems) rawconfig.T
- func AddFlagsGlobal(flags *pflag.FlagSet, p *OptsGlobal)
- func AddFlagsGlobalWithColorOutput(flags *pflag.FlagSet, color, output *string)
- func AddFlagsGlobalWithSelector(flags *pflag.FlagSet, objectSelector *string, ignoreNotFound *bool)
- func AddFlagsNodeGlobal(flagSet *pflag.FlagSet, p *OptsNodeGlobal)
- func AnySingleNode(selector string, c *client.T) (string, error)
- func CheckPRKeyUniqueness() error
- func CmdWithArg(cmd *cobra.Command, arg string)
- func ColorizeINI(b []byte) []byte
- func CommandNames(cmd *cobra.Command) []string
- func DataFromConfigFile(fpath string) ([]byte, error)
- func DataFromConfigHttp(u uri.T) ([]byte, error)
- func DataFromStdin() ([]byte, error)
- func DataFromTemplate(template string) ([]byte, error)
- func DeprecatedFlagDownTo(flags *pflag.FlagSet, p *string)
- func DeprecatedFlagSubsets(flags *pflag.FlagSet, p *string)
- func DeprecatedFlagTags(flags *pflag.FlagSet, p *string)
- func DeprecatedFlagUpTo(flags *pflag.FlagSet, p *string)
- func Doc(w io.Writer, items api.KeywordDefinitionItems, kind naming.Kind, ...) error
- func FlagCPUProfile(flags *pflag.FlagSet, p *string)
- func FlagCollectorApp(flags *pflag.FlagSet, p *string)
- func FlagCollectorPassword(flags *pflag.FlagSet, p *string)
- func FlagCollectorUser(flags *pflag.FlagSet, p *string)
- func FlagColor(flags *pflag.FlagSet, p *string)
- func FlagComplianceAttach(flags *pflag.FlagSet, p *bool)
- func FlagComplianceForce(flags *pflag.FlagSet, p *bool)
- func FlagConfirm(flags *pflag.FlagSet, p *bool)
- func FlagCreateConfig(flags *pflag.FlagSet, p *string)
- func FlagCreateEnv(flags *pflag.FlagSet, p *[]string)
- func FlagCreateForce(flags *pflag.FlagSet, p *bool)
- func FlagCreateNamespace(flags *pflag.FlagSet, p *string)
- func FlagCreateRestore(flags *pflag.FlagSet, p *bool)
- func FlagCron(flags *pflag.FlagSet, p *bool)
- func FlagDaemonHeartbeatFilter(flags *pflag.FlagSet, p *string)
- func FlagDaemonLogLevel(flags *pflag.FlagSet, p *string)
- func FlagDepth(flags *pflag.FlagSet, p *int)
- func FlagDevRoles(flags *pflag.FlagSet, p *string)
- func FlagDisableRollback(flags *pflag.FlagSet, p *bool)
- func FlagDiscard(flags *pflag.FlagSet, p *bool)
- func FlagDriver(flags *pflag.FlagSet, p *string)
- func FlagDryRun(flags *pflag.FlagSet, p *bool)
- func FlagDuration(flags *pflag.FlagSet, p *time.Duration)
- func FlagEnv(flags *pflag.FlagSet, p *[]string)
- func FlagEval(flags *pflag.FlagSet, p *bool)
- func FlagEventFilters(flags *pflag.FlagSet, p *[]string)
- func FlagEventLimit(flags *pflag.FlagSet, p *uint64)
- func FlagEventOutput(flags *pflag.FlagSet, p *string)
- func FlagEventReplay(flags *pflag.FlagSet, p *bool)
- func FlagEventTemplate(flags *pflag.FlagSet, p *string)
- func FlagEventWait(flags *pflag.FlagSet, p *bool)
- func FlagForce(flags *pflag.FlagSet, p *bool)
- func FlagFrom(flags *pflag.FlagSet, p *string)
- func FlagIgnoreNoCollectorConfigured(flags *pflag.FlagSet, p *bool)
- func FlagIgnoreNotFound(flags *pflag.FlagSet, p *bool)
- func FlagImpersonate(flags *pflag.FlagSet, p *string)
- func FlagKey(flags *pflag.FlagSet, p *string)
- func FlagKeyName(flags *pflag.FlagSet, p *string)
- func FlagKeyNames(flags *pflag.FlagSet, p *[]string)
- func FlagKeyTo(flags *pflag.FlagSet, p *string)
- func FlagKeyValue(flags *pflag.FlagSet, p *string)
- func FlagKeys(flags *pflag.FlagSet, p *[]string)
- func FlagKeyword(flags *pflag.FlagSet, p *string)
- func FlagKeywordOps(flags *pflag.FlagSet, p *[]string)
- func FlagKeywords(flags *pflag.FlagSet, p *[]string)
- func FlagLeader(flags *pflag.FlagSet, p *bool)
- func FlagLive(flags *pflag.FlagSet, p *bool)
- func FlagLocal(flags *pflag.FlagSet, p *bool)
- func FlagMaster(flags *pflag.FlagSet, p *bool)
- func FlagMatch(flags *pflag.FlagSet, p *string)
- func FlagModule(flags *pflag.FlagSet, p *string)
- func FlagModuleset(flags *pflag.FlagSet, p *string)
- func FlagMoveTo(flags *pflag.FlagSet, p *string)
- func FlagNetworkName(flags *pflag.FlagSet, p *[]string)
- func FlagNetworkStatusExtended(flags *pflag.FlagSet, p *bool)
- func FlagNetworkStatusName(flags *pflag.FlagSet, p *string)
- func FlagNoLock(flags *pflag.FlagSet, p *bool)
- func FlagNodeSelector(flags *pflag.FlagSet, p *string)
- func FlagNodeSelectorFilter(flags *pflag.FlagSet, p *string)
- func FlagNodeSelectorOrAll(flags *pflag.FlagSet, p *string)
- func FlagNodeSelectorOrLocalhost(flags *pflag.FlagSet, p *string)
- func FlagObjectSelector(flags *pflag.FlagSet, p *string)
- func FlagOutput(flags *pflag.FlagSet, p *string)
- func FlagOutputSections(flags *pflag.FlagSet, p *string)
- func FlagPeerSelectorFilter(flags *pflag.FlagSet, p *string)
- func FlagPoolName(flags *pflag.FlagSet, p *string)
- func FlagPoolStatusExtended(flags *pflag.FlagSet, p *bool)
- func FlagProvision(flags *pflag.FlagSet, p *bool)
- func FlagRID(flags *pflag.FlagSet, p *string)
- func FlagRIDWithCompletion(cmd *cobra.Command, p *string)
- func FlagRecover(flags *pflag.FlagSet, p *bool)
- func FlagRedactSecrets(flags *pflag.FlagSet, p *bool)
- func FlagRefresh(flags *pflag.FlagSet, p *bool)
- func FlagRefreshResInfo(flags *pflag.FlagSet, p *bool)
- func FlagRelay(flags *pflag.FlagSet, p *string)
- func FlagRoles(flags *pflag.FlagSet, p *[]string)
- func FlagRuleset(flags *pflag.FlagSet, p *string)
- func FlagSCSIHBA(flags *pflag.FlagSet, p *string)
- func FlagSCSILUN(flags *pflag.FlagSet, p *string)
- func FlagSCSITarget(flags *pflag.FlagSet, p *string)
- func FlagSections(flags *pflag.FlagSet, p *[]string)
- func FlagSlave(flags *pflag.FlagSet, p *[]string)
- func FlagSlaves(flags *pflag.FlagSet, p *bool)
- func FlagStateOnly(flags *pflag.FlagSet, p *bool)
- func FlagSubset(flags *pflag.FlagSet, p *string)
- func FlagSwitchTo(flags *pflag.FlagSet, p *string)
- func FlagTag(flags *pflag.FlagSet, p *string)
- func FlagTarget(flags *pflag.FlagSet, p *[]string)
- func FlagTime(flags *pflag.FlagSet, p *time.Duration)
- func FlagTo(flags *pflag.FlagSet, p *string)
- func FlagUpdateDelete(flags *pflag.FlagSet, p *[]string)
- func FlagUpdateSet(flags *pflag.FlagSet, p *[]string)
- func FlagUpdateUnset(flags *pflag.FlagSet, p *[]string)
- func FlagWait(flags *pflag.FlagSet, p *bool)
- func FlagWaitLock(flags *pflag.FlagSet, p *time.Duration)
- func FlagWatch(flags *pflag.FlagSet, p *bool)
- func FlagsAsync(flags *pflag.FlagSet, p *OptsAsync)
- func FlagsEncap(flags *pflag.FlagSet, p *OptsEncap)
- func FlagsLock(flags *pflag.FlagSet, p *OptsLock)
- func FlagsLogs(flags *pflag.FlagSet, p *OptsLogs)
- func FlagsResourceSelector(cmd *cobra.Command, p *OptsResourceSelector)
- func FlagsTo(flags *pflag.FlagSet, p *OptTo)
- func ForProgram(s string) string
- func GroupCommands(cmd *cobra.Command, groupID string) []*cobra.Command
- func HasGroup(cmd *cobra.Command, groupID string) bool
- func HeartbeatNames() []string
- func HeartbeatStreamNames() []string
- func HiddenFlagDisableRollback(flags *pflag.FlagSet, p *bool)
- func HiddenFlagForce(flags *pflag.FlagSet, p *bool)
- func HiddenFlagLeader(flags *pflag.FlagSet, p *bool)
- func HiddenFlagMaster(flags *pflag.FlagSet, p *bool)
- func HiddenFlagNoLock(flags *pflag.FlagSet, p *bool)
- func HiddenFlagNodeSelector(flags *pflag.FlagSet, p *string)
- func HiddenFlagObjectSelector(flags *pflag.FlagSet, p *string)
- func HiddenFlagRID(flags *pflag.FlagSet, p *string)
- func HiddenFlagRIDWithCompletion(cmd *cobra.Command, p *string)
- func HiddenFlagSlave(flags *pflag.FlagSet, p *[]string)
- func HiddenFlagSlaves(flags *pflag.FlagSet, p *bool)
- func HiddenFlagSubset(flags *pflag.FlagSet, p *string)
- func HiddenFlagTag(flags *pflag.FlagSet, p *string)
- func HiddenFlagTo(flags *pflag.FlagSet, p *string)
- func HiddenFlagWaitLock(flags *pflag.FlagSet, p *time.Duration)
- func HiddenFlagsEncap(flags *pflag.FlagSet, p *OptsEncap)
- func HiddenFlagsLock(flags *pflag.FlagSet, p *OptsLock)
- func HiddenFlagsResourceSelectorWithCompletion(cmd *cobra.Command, p *OptsResourceSelector)
- func HiddenFlagsTo(flags *pflag.FlagSet, p *OptTo)
- func InstanceStatusUpdatedWaiter(ctx context.Context, paths naming.Paths) (func(), error)
- func KeywordStoreFromAPI(items api.KeywordDefinitionItems) (store keywords.Store)
- func MergeSelector(selector string, subsysSelector string, kind string, defaultSelector string) string
- func NewCmdAll() *cobra.Command
- func NewCmdAnyConfigUpdate() *cobra.Command
- func NewCmdArrayList() *cobra.Command
- func NewCmdCcfg() *cobra.Command
- func NewCmdCfg() *cobra.Command
- func NewCmdClusterAbort() *cobra.Command
- func NewCmdClusterFreeze() *cobra.Command
- func NewCmdClusterLogs() *cobra.Command
- func NewCmdClusterSSHTrust() *cobra.Command
- func NewCmdClusterStatus() *cobra.Command
- func NewCmdClusterThaw() *cobra.Command
- func NewCmdClusterUnfreeze() *cobra.Command
- func NewCmdDaemon() *cobra.Command
- func NewCmdDaemonAudit() *cobra.Command
- func NewCmdDaemonAuth() *cobra.Command
- func NewCmdDaemonDNS() *cobra.Command
- func NewCmdDaemonDNSDump() *cobra.Command
- func NewCmdDaemonEvents() *cobra.Command
- func NewCmdDaemonHeartbeat() *cobra.Command
- func NewCmdDaemonHeartbeatList(defaultNodeSelectorFilter string) *cobra.Command
- func NewCmdDaemonHeartbeatRestart() *cobra.Command
- func NewCmdDaemonHeartbeatRotate() *cobra.Command
- func NewCmdDaemonHeartbeatStart() *cobra.Command
- func NewCmdDaemonHeartbeatStatus(defaultNodeSelectorFilter string) *cobra.Command
- func NewCmdDaemonHeartbeatStop() *cobra.Command
- func NewCmdDaemonKill() *cobra.Command
- func NewCmdDaemonListener() *cobra.Command
- func NewCmdDaemonListenerRestart() *cobra.Command
- func NewCmdDaemonListenerStart() *cobra.Command
- func NewCmdDaemonListenerStop() *cobra.Command
- func NewCmdDaemonLog() *cobra.Command
- func NewCmdDaemonPs() *cobra.Command
- func NewCmdDaemonRelay() *cobra.Command
- func NewCmdDaemonRelayList() *cobra.Command
- func NewCmdDaemonRelayStatus() *cobra.Command
- func NewCmdDaemonRestart() *cobra.Command
- func NewCmdDaemonRun() *cobra.Command
- func NewCmdDaemonRunning() *cobra.Command
- func NewCmdDaemonShutdown() *cobra.Command
- func NewCmdDaemonStart() *cobra.Command
- func NewCmdDaemonStatus() *cobra.Command
- func NewCmdDaemonStop() *cobra.Command
- func NewCmdHeartbeatSign() *cobra.Command
- func NewCmdHeartbeatWipe() *cobra.Command
- func NewCmdMonitor() *cobra.Command
- func NewCmdNetwork() *cobra.Command
- func NewCmdNetworkIP() *cobra.Command
- func NewCmdNode() *cobra.Command
- func NewCmdNodeCapabilities() *cobra.Command
- func NewCmdNodeCollector() *cobra.Command
- func NewCmdNodeCollectorTag() *cobra.Command
- func NewCmdNodeCompliance() *cobra.Command
- func NewCmdNodeConfigDoc() *cobra.Command
- func NewCmdNodeMetrics() *cobra.Command
- func NewCmdNodeRelay() *cobra.Command
- func NewCmdNodeSCSI() *cobra.Command
- func NewCmdNodeSSH() *cobra.Command
- func NewCmdNscfg() *cobra.Command
- func NewCmdObjectApp(kind string) *cobra.Command
- func NewCmdObjectClear(kind string) *cobra.Command
- func NewCmdObjectCollector(kind string) *cobra.Command
- func NewCmdObjectCompliance(kind string) *cobra.Command
- func NewCmdObjectConfig(kind string) *cobra.Command
- func NewCmdObjectConfigDoc(kind string) *cobra.Command
- func NewCmdObjectContainer(kind string) *cobra.Command
- func NewCmdObjectDisk(kind string) *cobra.Command
- func NewCmdObjectFS(kind string) *cobra.Command
- func NewCmdObjectGroupInfo(kind, group string) *cobra.Command
- func NewCmdObjectGroupList(kind, group string) *cobra.Command
- func NewCmdObjectGroupProvision(kind, group string) *cobra.Command
- func NewCmdObjectGroupRestart(kind, group string) *cobra.Command
- func NewCmdObjectGroupRun(kind, group string) *cobra.Command
- func NewCmdObjectGroupShutdown(kind, group string) *cobra.Command
- func NewCmdObjectGroupStart(kind, group string) *cobra.Command
- func NewCmdObjectGroupStartStandby(kind, group string) *cobra.Command
- func NewCmdObjectGroupStop(kind, group string) *cobra.Command
- func NewCmdObjectGroupUnprovision(kind, group string) *cobra.Command
- func NewCmdObjectIP(kind string) *cobra.Command
- func NewCmdObjectInstance(kind string) *cobra.Command
- func NewCmdObjectInstanceClear(kind, defaultNodeSelector string) *cobra.Command
- func NewCmdObjectInstanceDevice(kind string) *cobra.Command
- func NewCmdObjectInstancePG(kind string) *cobra.Command
- func NewCmdObjectKey(kind string) *cobra.Command
- func NewCmdObjectKeyAdd(kind string) *cobra.Command
- func NewCmdObjectKeyChange(kind string) *cobra.Command
- func NewCmdObjectKeyDecode(kind string) *cobra.Command
- func NewCmdObjectKeyEdit(kind string) *cobra.Command
- func NewCmdObjectKeyInstall(kind string) *cobra.Command
- func NewCmdObjectKeyList(kind string) *cobra.Command
- func NewCmdObjectKeyRemove(kind string) *cobra.Command
- func NewCmdObjectKeyRename(kind string) *cobra.Command
- func NewCmdObjectMonitor(selector, kind string) *cobra.Command
- func NewCmdObjectPrint(kind string) *cobra.Command
- func NewCmdObjectResource(kind string) *cobra.Command
- func NewCmdObjectSSH(kind string) *cobra.Command
- func NewCmdObjectSchedule(kind string) *cobra.Command
- func NewCmdObjectShare(kind string) *cobra.Command
- func NewCmdObjectSync(kind string) *cobra.Command
- func NewCmdObjectTask(kind string) *cobra.Command
- func NewCmdObjectVolume(kind string) *cobra.Command
- func NewCmdPool() *cobra.Command
- func NewCmdPoolVolume() *cobra.Command
- func NewCmdSVC() *cobra.Command
- func NewCmdSec() *cobra.Command
- func NewCmdUsr() *cobra.Command
- func NewCmdVol() *cobra.Command
- func NewGroupObjectKinds() *cobra.Group
- func NewGroupOrchestrated() *cobra.Group
- func NewGroupQuery() *cobra.Group
- func NewGroupReplication() *cobra.Group
- func NewGroupResources() *cobra.Group
- func NewGroupSubsystems() *cobra.Group
- func NodesFromPaths(c *client.T, selector string) ([]string, error)
- func ObjectInstanceDeleteRemoteFunc(ctx context.Context, p naming.Path, nodename string) (interface{}, error)
- func PostDaemonRestart(ctx context.Context, cli *client.T, nodename string) error
- func PostDaemonStop(ctx context.Context, cli *client.T, nodename string) error
- func RawStringSliceVar(flags *pflag.FlagSet, p *[]string, name string, value []string, usage string)
- func RawStringSliceVarP(flags *pflag.FlagSet, p *[]string, name, shorthand string, value []string, ...)
- func ReadPasswordFromStdinOrPrompt(prompt string) ([]byte, error)
- func RefreshInstanceStatusFromClusterStatus(ctx context.Context, clusterStatus clusterdump.Data) error
- func SectionBody(cmd *cobra.Command, title string) (string, bool)
- func Sections(b []byte, sections []string) []byte
- func SelectorFromStdin() string
- func SetCustomUsageTemplate(cmd *cobra.Command)
- func SetRIDFromArgs(rid *string, args []string, group, defaultRID string)
- func UsageFlagEventFilter() string
- func UsageFlagEventTemplate() string
- func ValidateArgs(root *cobra.Command, args []string) error
- func WaitAllInstanceMonitor(ctx context.Context, c *client.T, p naming.Path, timeout time.Duration, ...) error
- func WaitInstanceMonitor(ctx context.Context, c *client.T, p naming.Path, timeout time.Duration, ...) error
- func WaitInstanceStatusUpdated(ctx context.Context, c *client.T, nodename string, p naming.Path, ...) error
- func WalkCommands(cmd *cobra.Command, f func(*cobra.Command))
- type CmdClusterAbort
- type CmdClusterConfigDoc
- type CmdClusterFreeze
- type CmdClusterLogs
- type CmdClusterSSHTrust
- type CmdClusterUnfreeze
- type CmdDaemonAudit
- type CmdDaemonAuth
- type CmdDaemonDNSDump
- type CmdDaemonEvents
- type CmdDaemonHeartbeatList
- type CmdDaemonHeartbeatRestart
- type CmdDaemonHeartbeatRotate
- type CmdDaemonHeartbeatSign
- type CmdDaemonHeartbeatStart
- type CmdDaemonHeartbeatStop
- type CmdDaemonHeartbeatWipe
- type CmdDaemonKill
- type CmdDaemonListenerRestart
- type CmdDaemonListenerStart
- type CmdDaemonListenerStop
- type CmdDaemonLog
- type CmdDaemonPs
- type CmdDaemonRelayList
- type CmdDaemonSubAction
- type CmdNodeConfigDoc
- type CmdNodeDequeue
- type CmdNodeLogs
- type CmdNodeMetrics
- type CmdObjectConfigDoc
- type CmdObjectInstanceClear
- type CmdObjectLogs
- type CmdObjectMonitor
- type CmdPoolList
- type OptTo
- type OptsAsync
- type OptsEncap
- type OptsGlobal
- type OptsLock
- type OptsLogs
- type OptsNodeGlobal
- type OptsResourceSelector
- type PoolLine
Constants ¶
const ArgAnnotationKey = "args"
ArgAnnotationKey is the key used for the args annotation on cobra commands
const HeartbeatNameHelp = `` /* 293-byte string literal not displayed */
HeartbeatNameHelp is the NAME paragraph of the actions addressing a heartbeat as a whole, which all take the same argument.
const HeartbeatStreamNameHelp = `` /* 447-byte string literal not displayed */
HeartbeatStreamNameHelp is the NAME paragraph of the actions addressing one direction of a heartbeat, which is a component of its own.
Variables ¶
var ( ErrClientRequest = errors.New("client request") ErrClientStatusCode = errors.New("client request unexpected status code") ErrEventKindUnexpected = errors.New("unexpected event kind") ErrFetchFile = errors.New("fetch file") ErrFlagInvalid = errors.New("invalid command flag") ErrInstallFile = errors.New("install file") ErrPrint = errors.New("print") )
var ( GroupIDObjectKinds = "object kinds" GroupIDOrchestrated = "orchestrated" GroupIDQuery = "query" GroupIDSubsystems = "subsystems" GroupIDResourceGroups = "resource groups" GroupIDReplication = "replication" )
var AuditSubsystems = []string{ daemonenv.ListenerNameFamily, daemonenv.ListenerNameInet, daemonenv.ListenerNameUX, "ccfg", "collector", "cstat", "daemonauth", "daemondata", "discover", "dns", "hb", "hb.ctrl", "hb.main", "hb.peer_dropper", "hb:", "hook", "icfg", "icfg:", "imon", "imon:", "istat", "mntmon", "netmon", "nmon", "omon", "omon:", "pubsub", "runner", "scheduler", }
AuditSubsystems are the names a daemon audit selects its log feed with, as the subsystems register them.
The ones ending with a colon take a suffix: the object path for icfg, imon and omon, the heartbeat id for hb. A name is matched as a glob pattern, so "imon:*" audits every object monitor and "hb.*" every heartbeat component but the streams themselves.
var (
ErrCmdDaemonAuth = errors.New("command daemon auth")
)
var ListenerNameHelp = `NAME is: ` + daemonenv.ListenerNameInet + ` the listener serving the tcp port ` + daemonenv.ListenerNameUX + `, the listener serving the unix socket, has no start, stop or restart of its own: it lives as long as the daemon does, and the request asking for it travels through it. Restart the daemon to restart it.`
ListenerNameHelp is the NAME paragraph of the listener lifecycle actions, naming the listeners they may be addressed to. There are only two listeners, and they are the same on every node, so they are named here rather than looked up.
The unix socket listener is named too, saying why it is not a value: a reader who knows it exists, from an audit or from a status, would take its absence for an oversight.
Functions ¶
func APIKeywordItemsToRaw ¶
func APIKeywordItemsToRaw(items api.KeywordItems) rawconfig.T
func AddFlagsGlobal ¶
func AddFlagsGlobal(flags *pflag.FlagSet, p *OptsGlobal)
AddFlagsGlobal adds the global flags to the flag set. This is the common implementation used by both om and ox.
func AddFlagsGlobalWithColorOutput ¶
AddFlagsGlobalWithColorOutput adds color and output flags
func AddFlagsGlobalWithSelector ¶
AddFlagsGlobalWithSelector adds object selector and ignore not found flags
func AddFlagsNodeGlobal ¶
func AddFlagsNodeGlobal(flagSet *pflag.FlagSet, p *OptsNodeGlobal)
func CheckPRKeyUniqueness ¶
func CheckPRKeyUniqueness() error
CheckPRKeyUniqueness reports the nodes of the cluster that announce the same scsi3 persistent reservation key.
The key identifies a node to the storage, and two nodes holding the same one can each preempt the reservations of the other, which is what a scsireserv resource relies on to keep a peer away from a device it was not given. A duplicate is nearly always a node.conf copied to a peer without redacting the prkey.
The explanation goes to stderr and the error makes the exit code non zero, so that the caller's stdout still holds the value it asked for. A key that could not be read from the daemon is not a duplicate: the caller is told the check did not run, and is not failed for it.
func CmdWithArg ¶
CmdWithArg appends argument documentation to the command's args annotation. It handles line feeds, padding and indentation to format the text properly. The argument description will be displayed in the "Arguments:" section of the help output.
func ColorizeINI ¶
func CommandNames ¶
CommandNames returns the name of cmd and its aliases, deduplicated: a command naming itself in its own alias list is one name, not two.
func DataFromConfigFile ¶
func DataFromStdin ¶
func DataFromTemplate ¶
func DeprecatedFlagDownTo ¶
func DeprecatedFlagSubsets ¶
func DeprecatedFlagTags ¶
func DeprecatedFlagUpTo ¶
func FlagCPUProfile ¶
func FlagCollectorApp ¶
func FlagCollectorPassword ¶
func FlagCollectorUser ¶
func FlagComplianceAttach ¶
func FlagComplianceForce ¶
func FlagConfirm ¶
func FlagCreateConfig ¶
func FlagCreateEnv ¶
func FlagCreateForce ¶
func FlagCreateNamespace ¶
func FlagCreateRestore ¶
func FlagDaemonLogLevel ¶
func FlagDevRoles ¶
func FlagDisableRollback ¶
func FlagDiscard ¶
func FlagDriver ¶
func FlagDryRun ¶
func FlagEventFilters ¶
func FlagEventLimit ¶
func FlagEventOutput ¶
func FlagEventReplay ¶
func FlagEventTemplate ¶
func FlagEventWait ¶
func FlagIgnoreNotFound ¶
func FlagImpersonate ¶
func FlagKeyName ¶
func FlagKeyNames ¶
func FlagKeyValue ¶
func FlagKeyword ¶
func FlagKeywordOps ¶
func FlagKeywords ¶
func FlagLeader ¶
func FlagMaster ¶
func FlagModule ¶
func FlagModuleset ¶
func FlagMoveTo ¶
func FlagNetworkName ¶
func FlagNetworkStatusName ¶
func FlagNoLock ¶
func FlagNodeSelector ¶
func FlagNodeSelectorFilter ¶
func FlagNodeSelectorOrAll ¶
func FlagObjectSelector ¶
func FlagOutput ¶
func FlagOutputSections ¶
func FlagPeerSelectorFilter ¶
func FlagPoolName ¶
func FlagPoolStatusExtended ¶
func FlagProvision ¶
func FlagRIDWithCompletion ¶
FlagRIDWithCompletion adds the --rid flag to the given command and registers bash completion for it using the instance.Status resource map. Only provides completion if the selector is a valid path (not a filtering expression). Gets RIDs from status.json if present in the object's var directory (om only), otherwise falls back to the API.
func FlagRecover ¶
func FlagRedactSecrets ¶
func FlagRefresh ¶
func FlagRefreshResInfo ¶
func FlagRuleset ¶
func FlagSCSIHBA ¶
func FlagSCSILUN ¶
func FlagSCSITarget ¶
func FlagSections ¶
func FlagSlaves ¶
func FlagStateOnly ¶
func FlagSubset ¶
func FlagSwitchTo ¶
func FlagTarget ¶
func FlagUpdateDelete ¶
func FlagUpdateSet ¶
func FlagUpdateUnset ¶
func FlagsAsync ¶
func FlagsEncap ¶
func FlagsResourceSelector ¶
func FlagsResourceSelector(cmd *cobra.Command, p *OptsResourceSelector)
func ForProgram ¶
ForProgram renders a help text written for the om command under the name the binary was invoked as, so an ox help does not tell its reader to type om. The commands of the two binaries are built here, from one source, and the root command names itself the same way.
func GroupCommands ¶
GroupCommands returns the commands of cmd the usage template prints under the group.
func HeartbeatNames ¶
func HeartbeatNames() []string
HeartbeatNames returns the heartbeats the local cluster configuration defines, named as the actions take them: "1" for the "hb#1" section.
func HeartbeatStreamNames ¶
func HeartbeatStreamNames() []string
HeartbeatStreamNames returns the names a stream action may be addressed to: each heartbeat the local cluster configuration defines, which stands for both of its streams, and each of those streams.
func HiddenFlagForce ¶
func HiddenFlagLeader ¶
func HiddenFlagMaster ¶
func HiddenFlagNoLock ¶
func HiddenFlagNodeSelector ¶
func HiddenFlagRID ¶
func HiddenFlagRIDWithCompletion ¶
HiddenFlagRIDWithCompletion adds the hidden --rid flag to the given command and registers bash completion for it using the instance.Status resource map.
func HiddenFlagSlave ¶
func HiddenFlagSlaves ¶
func HiddenFlagSubset ¶
func HiddenFlagTag ¶
func HiddenFlagTo ¶
func HiddenFlagsEncap ¶
func HiddenFlagsLock ¶
func HiddenFlagsResourceSelectorWithCompletion ¶
func HiddenFlagsResourceSelectorWithCompletion(cmd *cobra.Command, p *OptsResourceSelector)
HiddenFlagsResourceSelectorWithCompletion adds hidden resource selector flags to the given command and registers bash completion for the --rid flag
func HiddenFlagsTo ¶
func KeywordStoreFromAPI ¶
func KeywordStoreFromAPI(items api.KeywordDefinitionItems) (store keywords.Store)
func MergeSelector ¶
func NewCmdAnyConfigUpdate ¶
func NewCmdArrayList ¶
func NewCmdClusterAbort ¶
func NewCmdClusterFreeze ¶
func NewCmdClusterLogs ¶
func NewCmdClusterSSHTrust ¶
func NewCmdClusterStatus ¶
func NewCmdClusterThaw ¶
func NewCmdClusterUnfreeze ¶
func NewCmdDaemon ¶
func NewCmdDaemonAudit ¶
func NewCmdDaemonAuth ¶
func NewCmdDaemonDNS ¶
func NewCmdDaemonDNSDump ¶
func NewCmdDaemonEvents ¶
func NewCmdDaemonHeartbeat ¶
func NewCmdDaemonHeartbeatStatus ¶
NewCmdDaemonHeartbeatStatus is the name the list command answered to before the listings were named after what they render: a row per stream. It is kept for the readers whose fingers and scripts type it.
func NewCmdDaemonKill ¶
func NewCmdDaemonListener ¶
func NewCmdDaemonLog ¶
func NewCmdDaemonPs ¶
func NewCmdDaemonRelay ¶
func NewCmdDaemonRelayList ¶
func NewCmdDaemonRelayStatus ¶
NewCmdDaemonRelayStatus is the name the list command answered to before the listings were named after what they render: a row per relay client. It is kept for the readers whose fingers and scripts type it.
func NewCmdDaemonRestart ¶
func NewCmdDaemonRun ¶
func NewCmdDaemonRunning ¶
func NewCmdDaemonShutdown ¶
func NewCmdDaemonStart ¶
func NewCmdDaemonStatus ¶
func NewCmdDaemonStop ¶
func NewCmdHeartbeatSign ¶
func NewCmdHeartbeatWipe ¶
func NewCmdMonitor ¶
func NewCmdNetwork ¶
NewCmdNetwork creates the "network" command
func NewCmdNetworkIP ¶
NewCmdNetworkIP creates the "ip" subcommand for network
func NewCmdNode ¶
func NewCmdNodeCapabilities ¶
NewCmdNodeCapabilities creates the "capabilities" subcommand for node
func NewCmdNodeCollector ¶
NewCmdNodeCollector creates the "collector" subcommand for node
func NewCmdNodeCollectorTag ¶
NewCmdNodeCollectorTag creates the "tag" subcommand for node collector
func NewCmdNodeCompliance ¶
NewCmdNodeCompliance creates the "compliance" subcommand for node
func NewCmdNodeConfigDoc ¶
func NewCmdNodeMetrics ¶
func NewCmdNodeRelay ¶
NewCmdNodeRelay creates the "relay" subcommand for node
func NewCmdNodeSCSI ¶
NewCmdNodeSCSI creates the "scsi" subcommand for node
func NewCmdNodeSSH ¶
NewCmdNodeSSH creates the "ssh" subcommand for node
func NewCmdObjectApp ¶
func NewCmdObjectClear ¶
func NewCmdObjectCollector ¶
func NewCmdObjectCompliance ¶
func NewCmdObjectConfig ¶
func NewCmdObjectConfigDoc ¶
func NewCmdObjectContainer ¶
func NewCmdObjectDisk ¶
func NewCmdObjectFS ¶
func NewCmdObjectGroupInfo ¶
func NewCmdObjectGroupList ¶
func NewCmdObjectGroupRun ¶
func NewCmdObjectGroupStart ¶
func NewCmdObjectGroupStop ¶
func NewCmdObjectIP ¶
func NewCmdObjectInstance ¶
func NewCmdObjectInstancePG ¶
func NewCmdObjectKey ¶
func NewCmdObjectKeyAdd ¶
func NewCmdObjectKeyChange ¶
func NewCmdObjectKeyDecode ¶
func NewCmdObjectKeyEdit ¶
func NewCmdObjectKeyInstall ¶
func NewCmdObjectKeyList ¶
func NewCmdObjectKeyRemove ¶
func NewCmdObjectKeyRename ¶
func NewCmdObjectMonitor ¶
func NewCmdObjectPrint ¶
func NewCmdObjectResource ¶
func NewCmdObjectSSH ¶
func NewCmdObjectSchedule ¶
func NewCmdObjectShare ¶
func NewCmdObjectSync ¶
func NewCmdObjectTask ¶
func NewCmdObjectVolume ¶
func NewCmdPoolVolume ¶
NewCmdPoolVolume creates the "volume" subcommand for pool
func NewGroupObjectKinds ¶
NewGroupObjectKinds returns the section listing the commands scoped to an object kind, at the root of the command tree.
func NewGroupOrchestrated ¶
func NewGroupQuery ¶
func NewGroupReplication ¶
func NewGroupResources ¶
func NewGroupSubsystems ¶
func PostDaemonRestart ¶
PostDaemonRestart sends an api request to restart the daemon and handles the response status codes.
func PostDaemonStop ¶
PostDaemonStop sends an api request to stop the daemon and handles the response status codes.
func RawStringSliceVar ¶
func RawStringSliceVarP ¶
func RefreshInstanceStatusFromClusterStatus ¶
func RefreshInstanceStatusFromClusterStatus(ctx context.Context, clusterStatus clusterdump.Data) error
RefreshInstanceStatusFromClusterStatus updates instance statuses for all nodes using cluster status data. It ensures instance status updates before return. Returns an error if client creation, API calls, or processing fails.
func SectionBody ¶
SectionBody returns what the usage of cmd prints under the section title, up to the next empty line, and whether the section is there at all.
func SelectorFromStdin ¶
func SelectorFromStdin() string
func SetCustomUsageTemplate ¶
SetCustomUsageTemplate sets the custom help template on a command. This template will display an Arguments section if the command has an "args" annotation. It uses [FLAGS] (uppercase) instead of [flags] for consistency with [ID].
func SetRIDFromArgs ¶
func UsageFlagEventFilter ¶
func UsageFlagEventFilter() string
func UsageFlagEventTemplate ¶
func UsageFlagEventTemplate() string
func ValidateArgs ¶
ValidateArgs returns an error when args name a command that does not exist.
cobra walks the command chain and, when the deepest command it reaches has no Run function, prints that command help and returns no error, silently dropping whatever was typed after it. A stale or mistyped command path exits 0 that way, which is how the daemon scheduler and the api exec kept reporting successful runs of commands renamed under their hard-coded argv.
func WaitAllInstanceMonitor ¶
func WaitAllInstanceMonitor(ctx context.Context, c *client.T, p naming.Path, timeout time.Duration, errC chan error) error
WaitAllInstanceMonitor launches a go routine that waits for all instance monitor updated events are received for an object within a given timeout, or ctx.Done() reached. The result of the wait is sent to the errC channel: nil if the InstanceMonitorUpdated event occurs, or a non-nil error otherwise.
It also filters the ObjectConfigUpdated events to get the expected Instance monitor updated events from the instance config scope nodes.
If acquiring the event reader fails, WaitInstanceMonitor returns the error immediately and does not send anything to errC.
func WaitInstanceMonitor ¶
func WaitInstanceMonitor(ctx context.Context, c *client.T, p naming.Path, timeout time.Duration, errC chan error) error
WaitInstanceMonitor launches a go routine that waits for a specific instance monitor update event within a given timeout, or ctx.Done() reached. The result of the wait is sent to the errC channel: nil if the InstanceMonitorUpdated event occurs, or a non-nil error otherwise.
If acquiring the event reader fails, WaitInstanceMonitor returns the error immediately and does not send anything to errC.
func WaitInstanceStatusUpdated ¶
func WaitInstanceStatusUpdated(ctx context.Context, c *client.T, nodename string, p naming.Path, timeout time.Duration, errC chan error) error
WaitInstanceStatusUpdated launches a go routine that waits for a specific instance status update event within a given timeout, or ctx.Done() reached. The result of the wait is sent to the errC channel: nil if the InstanceStatusUpdated event occurs, or a non-nil error otherwise.
If acquiring the event reader fails, WaitInstanceStatusUpdated returns the error immediately and does not send anything to errC.
Types ¶
type CmdClusterAbort ¶
func (*CmdClusterAbort) Run ¶
func (t *CmdClusterAbort) Run() error
type CmdClusterConfigDoc ¶
type CmdClusterConfigDoc struct {
Color string
Output string
Keyword string
Driver string
Depth int
}
func (*CmdClusterConfigDoc) Run ¶
func (t *CmdClusterConfigDoc) Run() error
type CmdClusterFreeze ¶
func (*CmdClusterFreeze) Run ¶
func (t *CmdClusterFreeze) Run() error
type CmdClusterLogs ¶
func (*CmdClusterLogs) Run ¶
func (t *CmdClusterLogs) Run() error
type CmdClusterSSHTrust ¶
type CmdClusterSSHTrust struct {
}
func (*CmdClusterSSHTrust) Run ¶
func (t *CmdClusterSSHTrust) Run() error
type CmdClusterUnfreeze ¶
func (*CmdClusterUnfreeze) Run ¶
func (t *CmdClusterUnfreeze) Run() error
type CmdDaemonAudit ¶
type CmdDaemonAudit struct {
CmdDaemonSubAction
Output string
Level string
Subsystems []string
Preempt bool
}
func (*CmdDaemonAudit) Run ¶
func (t *CmdDaemonAudit) Run() error
type CmdDaemonAuth ¶
type CmdDaemonAuth struct {
Roles []string
Subject string
Scope string
AccessDuration time.Duration
Out string
Refresh bool
RefreshDuration time.Duration
}
func (*CmdDaemonAuth) Run ¶
func (t *CmdDaemonAuth) Run() error
type CmdDaemonDNSDump ¶
func (*CmdDaemonDNSDump) Run ¶
func (t *CmdDaemonDNSDump) Run() error
type CmdDaemonEvents ¶
type CmdDaemonEvents struct {
OptsGlobal
Filters []string
Duration time.Duration
Limit uint64
Template string
Wait bool
// Replay is used to enable replay event from the cached state
Replay bool
Quiet bool
NodeSelector string
// contains filtered or unexported fields
}
func (*CmdDaemonEvents) DoNodes ¶
func (t *CmdDaemonEvents) DoNodes() error
type CmdDaemonHeartbeatList ¶
type CmdDaemonHeartbeatList struct {
Color string
Output string
NodeSelector string
PeerSelector string
Name string
}
func (*CmdDaemonHeartbeatList) Run ¶
func (t *CmdDaemonHeartbeatList) Run() error
type CmdDaemonHeartbeatRestart ¶
type CmdDaemonHeartbeatRestart struct {
CmdDaemonSubAction
Names []string
}
func (*CmdDaemonHeartbeatRestart) Run ¶
func (t *CmdDaemonHeartbeatRestart) Run() error
type CmdDaemonHeartbeatRotate ¶
func (*CmdDaemonHeartbeatRotate) Run ¶
func (t *CmdDaemonHeartbeatRotate) Run() error
type CmdDaemonHeartbeatSign ¶
type CmdDaemonHeartbeatSign struct {
CmdDaemonSubAction
Names []string
}
func (*CmdDaemonHeartbeatSign) Run ¶
func (t *CmdDaemonHeartbeatSign) Run() error
type CmdDaemonHeartbeatStart ¶
type CmdDaemonHeartbeatStart struct {
CmdDaemonSubAction
Names []string
}
func (*CmdDaemonHeartbeatStart) Run ¶
func (t *CmdDaemonHeartbeatStart) Run() error
type CmdDaemonHeartbeatStop ¶
type CmdDaemonHeartbeatStop struct {
CmdDaemonSubAction
Names []string
}
func (*CmdDaemonHeartbeatStop) Run ¶
func (t *CmdDaemonHeartbeatStop) Run() error
type CmdDaemonHeartbeatWipe ¶
type CmdDaemonHeartbeatWipe struct {
CmdDaemonSubAction
Names []string
}
func (*CmdDaemonHeartbeatWipe) Run ¶
func (t *CmdDaemonHeartbeatWipe) Run() error
type CmdDaemonKill ¶
type CmdDaemonKill struct {
CmdDaemonSubAction
Pid []int
Signal string
}
func (*CmdDaemonKill) Run ¶
func (t *CmdDaemonKill) Run() error
type CmdDaemonListenerRestart ¶
type CmdDaemonListenerRestart struct {
CmdDaemonSubAction
Name string
}
func (*CmdDaemonListenerRestart) Run ¶
func (t *CmdDaemonListenerRestart) Run() error
type CmdDaemonListenerStart ¶
type CmdDaemonListenerStart struct {
CmdDaemonSubAction
Name string
}
func (*CmdDaemonListenerStart) Run ¶
func (t *CmdDaemonListenerStart) Run() error
type CmdDaemonListenerStop ¶
type CmdDaemonListenerStop struct {
CmdDaemonSubAction
Name string
}
func (*CmdDaemonListenerStop) Run ¶
func (t *CmdDaemonListenerStop) Run() error
type CmdDaemonLog ¶
type CmdDaemonLog struct {
CmdDaemonSubAction
Level string
}
func (*CmdDaemonLog) Run ¶
func (t *CmdDaemonLog) Run() error
type CmdDaemonPs ¶
type CmdDaemonPs struct {
CmdDaemonSubAction
Output string
Color string
Subsystems string
Selector string
Rid string
}
func (*CmdDaemonPs) Run ¶
func (t *CmdDaemonPs) Run() error
type CmdDaemonRelayList ¶
func (*CmdDaemonRelayList) Run ¶
func (t *CmdDaemonRelayList) Run() error
type CmdDaemonSubAction ¶
type CmdDaemonSubAction struct {
Debug bool
NodeSelector string
// OnResponse, when set, receives the body each node answered
// with. It is called from the goroutine handling that node, so
// an implementation shared by several nodes serializes itself.
OnResponse func(nodename string, b []byte)
}
func (*CmdDaemonSubAction) Run ¶
func (t *CmdDaemonSubAction) Run(fn apiFuncWithNode) error
Run daemon sub-component action
func (*CmdDaemonSubAction) RunForEach ¶
func (t *CmdDaemonSubAction) RunForEach(names []string, fn func(name string) apiFuncWithNode) error
RunForEach runs the action once per name, so a command taking several names attempts them all rather than stopping on the first that fails, and reports every failure.
type CmdNodeConfigDoc ¶
func (*CmdNodeConfigDoc) Run ¶
func (t *CmdNodeConfigDoc) Run() error
type CmdNodeDequeue ¶
type CmdNodeDequeue struct {
OptsNodeGlobal
}
CmdNodeDequeue duplicates the omcmd and oxcmd CmdNodeDequeue configuration for nodes based on the specified NodeSelector.
func (*CmdNodeDequeue) Remote ¶
func (t *CmdNodeDequeue) Remote() error
Remote performs a remote action dequeue operation on nodes specified by the NodeSelector and returns any encountered errors.
type CmdNodeLogs ¶
type CmdNodeLogs struct {
OptsGlobal
OptsLogs
NodeSelector string
}
CmdNodeLogs duplicates the omcmd and oxcmd CmdNodeLogs configuration for fetching logs from nodes based on the specified NodeSelector.
func (*CmdNodeLogs) Remote ¶
func (t *CmdNodeLogs) Remote() error
Remote fetches logs remotely from the nodes specified by the NodeSelector, using concurrent streaming for each node. Returns an error if the client setup fails, no nodes are selected, or if there are issues during the process.
type CmdNodeMetrics ¶
type CmdNodeMetrics struct {
NodeSelector string
}
func (*CmdNodeMetrics) Run ¶
func (t *CmdNodeMetrics) Run() error
type CmdObjectConfigDoc ¶
type CmdObjectConfigDoc struct {
OptsGlobal
Color string
Output string
Keyword string
Driver string
Depth int
}
func (*CmdObjectConfigDoc) Run ¶
func (t *CmdObjectConfigDoc) Run(kind string) error
type CmdObjectInstanceClear ¶
func (*CmdObjectInstanceClear) Run ¶
func (t *CmdObjectInstanceClear) Run(kind string) error
type CmdObjectLogs ¶
type CmdObjectLogs struct {
OptsGlobal
OptsLogs
NodeSelector string
}
CmdObjectLogs duplicates the omcmd and oxcmd CmdObjectLogs configuration for fetching logs from nodes based on the specified NodeSelector.
func (*CmdObjectLogs) Remote ¶
func (t *CmdObjectLogs) Remote(selStr string) error
Remote executes the object log retrieval operation for selected nodes and paths in an asynchronous manner. It leverages the provided selector string to identify target objects and nodes for log streaming.
type CmdObjectMonitor ¶
type CmdObjectMonitor struct {
Color string
ObjectSelector string
Output string
Sections string
Watch bool
}
func (*CmdObjectMonitor) Run ¶
func (t *CmdObjectMonitor) Run(selector, kind string) error
type CmdPoolList ¶
type CmdPoolList struct {
OptsGlobal
Name string
NodeSelector string
}
func (*CmdPoolList) Run ¶
func (t *CmdPoolList) Run() error
type OptsEncap ¶
type OptsEncap struct {
// A list of encap instance, identified by hostname of the container
Slaves []string
// The host instance
Master bool
// All encap instances
AllSlaves bool
}
OptsEncap contains options to select where a instance action runs with a encap enabled service
type OptsGlobal ¶
type OptsLogs ¶
OptsLogs contains options used by all log commands: node logs, cluster logs, object logs
type OptsNodeGlobal ¶
type OptsResourceSelector ¶
OptsResourceSelector contains options needed to initialize a resourceselector.Options struct
type PoolLine ¶
type PoolLine struct {
api.Pool
BinSize string `json:"bin_size"`
BinUsed string `json:"bin_used"`
BinFree string `json:"bin_free"`
}
PoolLine is a pool as a listing shows it: the pool the api sent, and the sizes in the units a reader reads.
The embedded value is inlined, by the json encoder and by the jsonpath the tab expressions are written in alike, so a column names a pool field directly and the columns added here sit next to them.
func NewPoolLine ¶
NewPoolLine returns the pool as a listing shows it.
Source Files
¶
- args.go
- cluster_abort.go
- cluster_config_doc.go
- cluster_freeze.go
- cluster_logs.go
- cluster_ssh_trust.go
- cluster_status.go
- cluster_unfreeze.go
- cobra_helpers.go
- config.go
- config_doc.go
- config_update.go
- daemon.go
- daemon_audit.go
- daemon_auth.go
- daemon_dns_dump.go
- daemon_events.go
- daemon_hb_list.go
- daemon_hb_restart.go
- daemon_hb_rotate.go
- daemon_hb_sign.go
- daemon_hb_start.go
- daemon_hb_stop.go
- daemon_hb_wipe.go
- daemon_kill.go
- daemon_listener_restart.go
- daemon_listener_start.go
- daemon_listener_stop.go
- daemon_log.go
- daemon_ps.go
- daemon_relay_list.go
- daemon_sub_action.go
- daemon_subsystems.go
- errors.go
- factory_kind.go
- flag_raw_string_slice.go
- flags.go
- flags_global.go
- groups.go
- help.go
- main.go
- node.go
- node_config_doc.go
- node_dequeue.go
- node_log.go
- node_metrics.go
- node_prkey.go
- object.go
- object_clear.go
- object_config_doc.go
- object_create.go
- object_instance_delete.go
- object_instance_pg.go
- object_key.go
- object_log.go
- object_monitor.go
- object_schedule.go
- options.go
- password.go
- pool_list.go
- post_daemon_restart.go
- post_daemon_stop.go