preflight

package
v0.0.0-...-057f6e6 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 27 Imported by: 3

Documentation

Index

Constants

View Source
const GB = 1 << 30

Variables

View Source
var TCPState_name = map[TCPState]string{
	TCPStateEstablished: "ESTABLISHED",
	TCPStateSynSent:     "SYN_SENT",
	TCPStateSynRecv:     "SYN_RECV",
	TCPStateFinWait1:    "FIN_WAIT1",
	TCPStateFinWait2:    "FIN_WAIT2",
	TCPStateTimeWait:    "TIME_WAIT",
	TCPStateClose:       "CLOSE",
	TCPStateCloseWait:   "CLOSE_WAIT",
	TCPStateLastAck:     "LAST_ACK",
	TCPStateListen:      "LISTEN",
	TCPStateClosing:     "CLOSING",
	TCPStateUnknown:     "UNKNOWN",
}

Functions

func RunDeployPreflightCheck

func RunDeployPreflightCheck(opts DeployPreflightCheckOptions) (string, error)

RunDeployPreflightCheck runs the Deploy preflight checks

Types

type Check

type Check struct {
	Name        string
	Description string
	TestFunc    func(TestProbe) error
}

func CLIInBin

func CLIInBin() Check

func ConnectivityCheck

func ConnectivityCheck(urls []string) Check

func DefaultConnectivityCheck

func DefaultConnectivityCheck() Check

func DefaultKernelVersionCheck

func DefaultKernelVersionCheck() Check

func DefaultMinimumDiskCheck

func DefaultMinimumDiskCheck(c *dc.AutomateConfig) Check

func DefaultMinimumRAMCheck

func DefaultMinimumRAMCheck() Check

func DefaultPortCheck

func DefaultPortCheck(skipShared bool, config *dc.AutomateConfig) (Check, error)

func DefaultSysctlCheck

func DefaultSysctlCheck() Check

func HasCmdCheck

func HasCmdCheck(cmdName string) Check

func HasNobodyCheck

func HasNobodyCheck() Check

func HasUserCheck

func HasUserCheck(username string) Check

func HasUseraddCheck

func HasUseraddCheck() Check

func IsA2DeployedCheck

func IsA2DeployedCheck(portCheck *Check) Check

func IsSystemdCheck

func IsSystemdCheck() Check

func KernelVersionCheck

func KernelVersionCheck(minimumVersion proc.KernelVersion) Check

func MinimumDiskCheck

func MinimumDiskCheck(minimumBytes uint64) Check

func MinimumRAMCheck

func MinimumRAMCheck(kiloBytesMinimum int) Check

func PortCheck

func PortCheck(portsToCheck []int) Check

func RootUserRequiredCheck

func RootUserRequiredCheck() Check

func SELinuxPermissiveCheck

func SELinuxPermissiveCheck() Check

type ConsoleReporter

type ConsoleReporter struct {
	// contains filtered or unexported fields
}

func NewConsoleReporter

func NewConsoleReporter() *ConsoleReporter

func (*ConsoleReporter) HasFailures

func (r *ConsoleReporter) HasFailures() bool

func (*ConsoleReporter) PrintSummaries

func (c *ConsoleReporter) PrintSummaries()

func (*ConsoleReporter) ReportFailure

func (r *ConsoleReporter) ReportFailure(msg string)

func (*ConsoleReporter) ReportSuccess

func (*ConsoleReporter) ReportSuccess(msg string)

func (*ConsoleReporter) ReportSummary

func (r *ConsoleReporter) ReportSummary(msg string)

type DeployPreflightCheckOptions

type DeployPreflightCheckOptions struct {
	SkipSharedPortCheck bool
	SkipA2DeployedCheck bool
	Airgap              bool
	AutomateConfig      *dc.AutomateConfig
}

type DeployPreflightChecker

type DeployPreflightChecker struct {
	// contains filtered or unexported fields
}

func (*DeployPreflightChecker) Run

func (c *DeployPreflightChecker) Run(probe TestProbe) error

type InMemoryPrintReporter

type InMemoryPrintReporter struct {
	// contains filtered or unexported fields
}

func NewInMemoryPrintReporter

func NewInMemoryPrintReporter() *InMemoryPrintReporter

func (*InMemoryPrintReporter) HasFailures

func (r *InMemoryPrintReporter) HasFailures() bool

func (*InMemoryPrintReporter) Out

func (r *InMemoryPrintReporter) Out() string

func (*InMemoryPrintReporter) ReportFailure

func (r *InMemoryPrintReporter) ReportFailure(msg string)

func (*InMemoryPrintReporter) ReportSuccess

func (r *InMemoryPrintReporter) ReportSuccess(msg string)

func (*InMemoryPrintReporter) ReportSummary

func (r *InMemoryPrintReporter) ReportSummary(msg string)

type Reporter

type Reporter interface {
	ReportSuccess(string)
	ReportFailure(string)
	ReportSummary(string)
}

type SysctlCheck

type SysctlCheck struct {
	Name       string
	RangeLower uint64
	RangeUpper uint64
	FixValue   uint64
}

func (SysctlCheck) IsRange

func (s SysctlCheck) IsRange() bool

func (SysctlCheck) IsValid

func (s SysctlCheck) IsValid(val uint64) bool

func (SysctlCheck) SysctlString

func (s SysctlCheck) SysctlString() string

type TCPInfo

type TCPInfo struct {
	LocalIP   net.IP
	LocalPort int
	State     TCPState
}

type TCPState

type TCPState int
const (
	TCPStateEstablished TCPState = 1
	TCPStateSynSent     TCPState = 2
	TCPStateSynRecv     TCPState = 3
	TCPStateFinWait1    TCPState = 4
	TCPStateFinWait2    TCPState = 5
	TCPStateTimeWait    TCPState = 6
	TCPStateClose       TCPState = 7
	TCPStateCloseWait   TCPState = 8
	TCPStateLastAck     TCPState = 9
	TCPStateListen      TCPState = 10
	TCPStateClosing     TCPState = 11
	TCPStateUnknown     TCPState = 12
)

func (TCPState) String

func (tcpState TCPState) String() string

type TestProbe

type TestProbe interface {
	Reporter
	File(filePath string) ([]byte, error)
	IsSymlink(filePath string) (bool, error)
	Euid() int
	AvailableDiskSpace(path string) (uint64, error)
	LookupUser(username string) (*user.User, error)
	LookPath(file string) (string, error)
	HTTPConnectivity(url string) error
	SELinuxStatus() ([]byte, error)
}

func NewTestProbe

func NewTestProbe(r Reporter) TestProbe

Jump to

Keyboard shortcuts

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