checker

package
v6.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorBlack   = "\x1b[0;30m"
	ColorRed     = "\x1b[0;31m"
	ColorGreen   = "\x1b[0;32m"
	ColorYellow  = "\x1b[0;33m"
	ColorBlue    = "\x1b[0;34m"
	ColorMagenta = "\x1b[0;35m"
	ColorGrey    = "\x1b[0;36m"
	ColorNone    = "\x1b[0m"
)

foreground colours

Variables

View Source
var DefaultShell = "elvish"

DefaultShell is used by EmergencyShell

Functions

func Run

func Run(checklist []Check) error

Run runs the checks and remediations from a check list, in order, and prints the check and remediation status.

Types

type Check

type Check struct {
	Name        string
	Run         Checker
	Remediate   Remediator
	StopOnError bool
}

Check is a type that implements a netboot check

type Checker

type Checker func() error

Checker is the type of checking functions

func CommandExecutor

func CommandExecutor(prog string, args ...string) Checker

CommandExecutor returns a check that runs the provided command and arguments.

func InterfaceCanDoDHCPv6

func InterfaceCanDoDHCPv6(ifname string) Checker

InterfaceCanDoDHCPv6 checks whether DHCPv6 succeeds on an interface, and if it has a valid netboot URL.

func InterfaceExists

func InterfaceExists(ifname string) Checker

InterfaceExists returns a Checker that verifies if an interface is present on the system

func InterfaceHasGlobalAddresses

func InterfaceHasGlobalAddresses(ifname string) Checker

InterfaceHasGlobalAddresses returns a Checker that verifies if an interface has at least one global address.

func InterfaceHasLinkLocalAddress

func InterfaceHasLinkLocalAddress(ifname string) Checker

InterfaceHasLinkLocalAddress returns a Checker that verifies if an interface has a configured link-local address.

func LinkAutoneg

func LinkAutoneg(ifname string, expected bool) Checker

LinkAutoneg checks if the link auto-negotiation state, and return an error if it's not the expected state.

func LinkSpeed

func LinkSpeed(ifname string, minSpeed int) Checker

LinkSpeed checks the link speed, and complains if smaller than `min` megabit/s.

type Remediator

type Remediator func() error

Remediator is the type of remediation functions

func CommandExecutorRemediation

func CommandExecutorRemediation(prog string, args ...string) Remediator

CommandExecutorRemediation is like CommandExecutor, but returns a Remediator.

func EmergencyShell

func EmergencyShell(banner string) Remediator

EmergencyShell is a remediation that prints the given banner, and then calls an emergency shell.

func InterfaceRemediate

func InterfaceRemediate(ifname string) Remediator

InterfaceRemediate returns a Remediator that tries to fix a missing interface issue.

Jump to

Keyboard shortcuts

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