command

package
v0.0.0-...-c27a53e Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 67 Imported by: 0

Documentation

Overview

Package command implements the top-level `process-agent` binary, including its subcommands.

Index

Constants

View Source
const LoggerName pkglogsetup.LoggerName = "PROCESS"
View Source
const UseWinParams = false

UseWinParams is set to true when ran on Windows

Variables

View Source
var DaemonLogParams = log.ForDaemon(string(LoggerName), "process_config.log_file", pkgconfigsetup.DefaultProcessAgentLogFile)

DaemonLogParams are the log params should be given to the `core.BundleParams` for when the process agent is running as a daemon

View Source
var OneShotLogParams = log.ForOneShot(string(LoggerName), "info", true)

OneShotLogParams are the log params that are given to commands

Functions

func FixDeprecatedFlags

func FixDeprecatedFlags(args []string, w io.Writer) []string

FixDeprecatedFlags transforms args so that they are conforming to the new CLI structure: - replace non-posix flags posix flags - replace deprecated flags with their command equivalents - display warnings when deprecated flags are encountered

func GetCoreBundleParamsForOneShot

func GetCoreBundleParamsForOneShot(globalParams *GlobalParams) core.BundleParams

func MakeCommand

func MakeCommand(subcommandFactories []SubcommandFactory, winParams bool, rootCmdRun func(globalParams *GlobalParams)) *cobra.Command

MakeCommand makes the top-level Cobra command for this app.

func RootCmdRun

func RootCmdRun(globalParams *GlobalParams)

RootCmdRun is the main function to run the process agent

func SetHostMountEnv

func SetHostMountEnv(logger log.Component)

SetHostMountEnv sets HOST_PROC and HOST_SYS mounts if applicable in containerized environments

Types

type GlobalParams

type GlobalParams struct {
	// ConfFilePath holds the path to the folder containing the configuration
	// file, to allow overrides from the command line
	ConfFilePath string

	// ExtraConfFilePath represents the paths to additional configuration files.
	ExtraConfFilePath []string

	// SysProbeConfFilePath holds the path to the folder containing the system-probe
	// configuration file, to allow overrides from the command line
	SysProbeConfFilePath string

	// FleetPoliciesDirPath holds the path to the folder containing the fleet policies
	FleetPoliciesDirPath string

	// PidFilePath specifies the path to the pid file
	PidFilePath string

	// WinParams provides windows specific options
	WinParams WinParams

	// NoColor is a flag to disable color output
	NoColor bool
}

GlobalParams contains the values of agent-global Cobra flags.

A pointer to this type is passed to SubcommandFactory's, but its contents are not valid until Cobra calls the subcommand's Run or RunE function.

type SubcommandFactory

type SubcommandFactory func(globalParams *GlobalParams) []*cobra.Command

SubcommandFactory is a callable that will return a slice of subcommands.

type WinParams

type WinParams struct {
	// StartService handles starting the service
	StartService bool

	// StopService handles stopping the service
	StopService bool

	// Foreground handles running the service in the foreground
	Foreground bool
}

WinParams specifies Windows-specific CLI params

Jump to

Keyboard shortcuts

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