Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyWatermarks(drive *common.Drive) (func() error, error)
- func CreateVirtualDiskError(createStdout []byte) error
- func DestroyVirtualDiskError(destroyStdout []byte) error
- func InvalidBlockSizeError(blockSize uint) error
- func InvalidInfoTypeError(infoType string) error
- func InvalidInitModeError(initMode string) error
- func InvalidRaidModeError(raidMode string) error
- func InvalidVirtualDiskIDError(virtualDiskID int) error
- type AsrrBioscontrol
- type Blkdiscard
- type CommandStatus
- type Controller
- type DellRacadm
- type DeviceIdentifiers
- type Dmidecode
- func (d *Dmidecode) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
- func (d *Dmidecode) BIOSVersion() (string, error)
- func (d *Dmidecode) BaseBoardManufacturer() (string, error)
- func (d *Dmidecode) BaseBoardProductName() (string, error)
- func (d *Dmidecode) BaseBoardSerialNumber() (string, error)
- func (d *Dmidecode) ChassisSerialNumber() (string, error)
- func (d *Dmidecode) Manufacturer() (string, error)
- func (d *Dmidecode) ProductName() (string, error)
- func (d *Dmidecode) SerialNumber() (string, error)
- func (d *Dmidecode) TPMs(context.Context) ([]*common.TPM, error)
- type Dnf
- type DnfRepoParams
- type Dsu
- func (d *Dsu) ApplyLocalUpdates(ctx context.Context, updateDir string) (int, error)
- func (d *Dsu) ApplyUpdates() (int, error)
- func (d *Dsu) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
- func (d *Dsu) ComponentFirmwareUpdatePreview(ctx context.Context) ([]*model.Component, int, error)
- func (d *Dsu) FetchUpdateFiles(ctx context.Context, dstDir string) (int, error)
- func (d *Dsu) Inventory(ctx context.Context) ([]*model.Component, error)
- func (d *Dsu) Version() (string, error)
- type ExecError
- type Execute
- func (e *Execute) CheckExecutable() error
- func (e *Execute) CmdPath() string
- func (e *Execute) DisableBinCheck()
- func (e *Execute) Exec(ctx context.Context) (result *Result, err error)
- func (e *Execute) GetCmd() string
- func (e *Execute) SetArgs(a ...string)
- func (e *Execute) SetEnv(env []string)
- func (e *Execute) SetExitCode(_ int)
- func (e *Execute) SetQuiet()
- func (e *Execute) SetStderr(_ []byte)
- func (e *Execute) SetStdin(r io.Reader)
- func (e *Execute) SetStdout(_ []byte)
- func (e *Execute) SetVerbose()
- type Executor
- type FakeExecute
- func (e *FakeExecute) CheckExecutable() error
- func (e *FakeExecute) CmdPath() string
- func (e *FakeExecute) DisableBinCheck()
- func (e *FakeExecute) Exec(_ context.Context) (*Result, error)
- func (e *FakeExecute) GetCmd() string
- func (e *FakeExecute) SetArgs(a ...string)
- func (e *FakeExecute) SetEnv(env []string)
- func (e *FakeExecute) SetExitCode(i int)
- func (e *FakeExecute) SetQuiet()
- func (e *FakeExecute) SetStderr(b []byte)
- func (e *FakeExecute) SetStdin(r io.Reader)
- func (e *FakeExecute) SetStdout(b []byte)
- func (e *FakeExecute) SetVerbose()
- type FakeLshwExecute
- type FakeRacadmExecute
- type FakeSMCSumExecute
- type FakeSmartctlExecute
- func (e *FakeSmartctlExecute) CheckExecutable() error
- func (e *FakeSmartctlExecute) CmdPath() string
- func (e *FakeSmartctlExecute) Exec(context.Context) (*Result, error)
- func (e *FakeSmartctlExecute) SetArgs(a ...string)
- func (e *FakeSmartctlExecute) SetExitCode(i int)
- func (e *FakeSmartctlExecute) SetStdin(r io.Reader)
- type FillZero
- type Flashrom
- type Hdparm
- func (h *Hdparm) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
- func (h *Hdparm) DriveCapabilities(ctx context.Context, logicalName string) ([]*common.Capability, error)
- func (h *Hdparm) Erase(ctx context.Context, drive *common.Drive, ses SecureEraseSetting) error
- func (h *Hdparm) Sanitize(ctx context.Context, drive *common.Drive, sanact SanitizeAction) error
- func (h *Hdparm) WipeDrive(ctx context.Context, logger *logrus.Logger, drive *common.Drive) error
- type Ipmicfg
- func (i *Ipmicfg) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
- func (i *Ipmicfg) BIOS(ctx context.Context) (*common.BIOS, error)
- func (i Ipmicfg) BMC(ctx context.Context) (*common.BMC, error)
- func (i Ipmicfg) CPLDs(ctx context.Context) ([]*common.CPLD, error)
- func (i *Ipmicfg) Summary(ctx context.Context) (*IpmicfgSummary, error)
- type IpmicfgSummary
- type Lsblk
- type Lshw
- type LshwNode
- type LshwNodeCapabilities
- type LshwNodeConfiguration
- type LshwOutput
- type Mlxup
- func (m *Mlxup) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
- func (m *Mlxup) NICs(ctx context.Context) ([]*common.NIC, error)
- func (m *Mlxup) Query(ctx context.Context) ([]*MlxupDevice, error)
- func (m *Mlxup) UpdateNIC(ctx context.Context, updateFile, modelNumber string, force bool) error
- func (m *Mlxup) UpdateRequirements(_ string) *model.UpdateRequirements
- type MlxupDevice
- type Msecli
- func (m *Msecli) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
- func (m *Msecli) Drives(ctx context.Context) ([]*common.Drive, error)
- func (m *Msecli) Query(ctx context.Context) ([]*MsecliDevice, error)
- func (m *Msecli) UpdateDrive(ctx context.Context, updateFile, modelNumber, serialNumber string) error
- type MsecliDevice
- type Mvcli
- func (m *Mvcli) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
- func (m *Mvcli) Create(ctx context.Context, physicalDiskIDs []uint, raidMode, name string, ...) error
- func (m *Mvcli) CreateVirtualDisk(ctx context.Context, raidMode string, physicalDisks []uint, name string, ...) error
- func (m *Mvcli) Destroy(ctx context.Context, virtualDiskID int) error
- func (m *Mvcli) DestroyVirtualDisk(ctx context.Context, virtualDiskID int) error
- func (m *Mvcli) Drives(ctx context.Context) ([]*common.Drive, error)
- func (m *Mvcli) FindVdBy(ctx context.Context, k string, v interface{}) *MvcliDevice
- func (m *Mvcli) FindVdByID(ctx context.Context, virtualDiskID int) *MvcliDevice
- func (m *Mvcli) FindVdByName(ctx context.Context, name string) *MvcliDevice
- func (m *Mvcli) Info(ctx context.Context, infoType string) ([]*MvcliDevice, error)
- func (m *Mvcli) StorageControllers(ctx context.Context) ([]*common.StorageController, error)
- func (m *Mvcli) VirtualDisks(ctx context.Context) ([]*MvcliDevice, error)
- type MvcliDevice
- type Nvme
- func (n *Nvme) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
- func (n *Nvme) DriveCapabilities(ctx context.Context, logicalName string) ([]*common.Capability, error)
- func (n *Nvme) Drives(ctx context.Context) ([]*common.Drive, error)
- func (n *Nvme) Format(ctx context.Context, drive *common.Drive, ses SecureEraseSetting) error
- func (n *Nvme) ResetNS(ctx context.Context, logicalName string) error
- func (n *Nvme) Sanitize(ctx context.Context, drive *common.Drive, sanact SanitizeAction) error
- func (n *Nvme) WipeDrive(ctx context.Context, logger *logrus.Logger, drive *common.Drive) error
- type ResponseData
- type Result
- type SanitizeAction
- type SecureEraseSetting
- type ShowController
- type Smartctl
- func (s *Smartctl) All(ctx context.Context, device string) (*SmartctlDriveAttributes, error)
- func (s *Smartctl) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
- func (s *Smartctl) Drives(ctx context.Context) ([]*common.Drive, error)
- func (s *Smartctl) Scan(ctx context.Context) (*SmartctlScan, error)
- type SmartctlDrive
- type SmartctlDriveAttributes
- type SmartctlScan
- type SmartctlStatus
- type StoreCLI
- type SupermicroSUM
- func (s *SupermicroSUM) ApplyUpdate(ctx context.Context, updateFile, componentSlug string) error
- func (s *SupermicroSUM) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
- func (s *SupermicroSUM) Collect(_ *common.Device) error
- func (s *SupermicroSUM) Components() ([]*model.Component, error)
- func (s *SupermicroSUM) GetBIOSConfiguration(ctx context.Context, _ string) (map[string]string, error)
- func (s *SupermicroSUM) UpdateBIOS(ctx context.Context, updateFile, modelNumber string) error
- func (s *SupermicroSUM) UpdateBMC(ctx context.Context, updateFile, _ string) error
- type UEFIVarEntry
- type UEFIVariableCollector
- type UEFIVars
- type UefiFirmwareParser
Constants ¶
const ( // EnvAsrrBiosUtility - to override the utility path EnvAsrrBiosUtility = "IRONLIB_UTIL_ASRR_BIOSCONTROL" // EnvAsrrKernelModule - to overide the kernel module path EnvAsrrKernelModule = "KERNEL_MODULE_ASRR" )
const ( DellRacadmPath = "/opt/dell/srvadmin/bin/idracadm7" EnvVarRacadm7 = "IRONLIB_UTIL_RACADM7" )
const ( // see test_data/dsu_return_codes.md DSUExitCodeUpdatesApplied = 0 DSUExitCodeRebootRequired = 8 DSUExitCodeNoUpdatesAvailable = 34 // EnvDellDSURelease is the Dell DSU release version // // e.g: 21.11.12 from https://linux.dell.com/repo/hardware/DSU_21.11.12/ EnvDellDSURelease = "DELL_DSU_RELEASE" // EnvDellDSUVersion is the Dell DSU utility package version // // e.g: 1.9.2.0-21.07.00 from https://linux.dell.com/repo/hardware/DSU_21.11.12/os_independent/x86_64/dell-system-update-1.9.2.0-21.07.00.x86_64.rpm EnvDellDSUVersion = "DELL_DSU_VERSION" LocalUpdatesDirectory = "/root/dsu" EnvDsuUtility = "IRONLIB_UTIL_DSU" )
const ( EnvLsblkUtility = "IRONLIB_UTIL_LSBLK" LsblkUtility model.CollectorUtility = "lsblk" )
const ( EnvMvcliUtility = "IRONLIB_UTIL_MVCLI" BitsUint8 = 8 BitsInt64 = 64 )
const ( EnvUefiFirmwareParserUtility = "IRONLIB_UTIL_UTIL_UEFI_FIRMWARE_PARSER" UefiFirmwareParserUtility model.CollectorUtility = "uefi-firmware-parser" )
const (
EnvBlkdiscardUtility = "IRONLIB_UTIL_BLKDISCARD"
)
const EnvDmidecodeUtility = "IRONLIB_UTIL_DMIDECODE"
const (
// EnvDnfUtility - to override the utility path
EnvDnfUtility = "IRONLIB_UTIL_DNF"
)
const (
EnvFlashromUtility = "IRONLIB_UTIL_FLASHROM"
)
const (
EnvHdparmUtility = "IRONLIB_UTIL_HDPARM"
)
const (
EnvLshwUtility = "IRONLIB_UTIL_LSHW"
)
const (
EnvMlxupUtility = "IRONLIB_UTIL_MLXUP"
)
const (
EnvMsecliUtility = "IRONLIB_UTIL_MSECLI"
)
const EnvNvmeUtility = "IRONLIB_UTIL_NVME"
const EnvSmartctlUtility = "IRONLIB_UTIL_SMARTCTL"
const EnvSmcIpmicfgUtility = "IRONLIB_UTIL_SMC_IPMICFG"
const EnvStorecliUtility = "IRONLIB_UTIL_STORECLI"
const EnvVarSumPath = "IRONLIB_UTIL_SUM"
const (
UefiVariableCollectorUtility model.CollectorUtility = "uefi-variable-collector"
)
Variables ¶
var ( ErrDellBiosCfgNil = errors.New("expected valid bios config object, got nil") ErrDellBiosCfgFileUndefined = errors.New("no BIOS config file defined") ErrDellBiosCfgFileEmpty = errors.New("BIOS config file empty or invalid") )
var ( ErrDsuInventoryCollectorBinMissing = errors.New("dsu inventory collector executable missing 'invcol_*_*.BIN'") ErrMultipleDsuInventoryCollectorBins = errors.New("multiple inventory collector bins found") ErrDsuUpdatesDirectoryMissing = errors.New("dsu updates directory missing") ErrDsuVersionQuery = errors.New("dsu version query error") )
var ( ErrNoCommandOutput = errors.New("command returned no output") ErrVersionStrExpectedSemver = errors.New("expected version string to follow semver format") ErrFakeExecutorInvalidArgs = errors.New("invalid number of args passed to fake executor") ErrRepositoryBaseURL = errors.New("repository base URL undefined, ensure UpdateOptions.BaseURL OR UPDATE_BASE_URL env var is set") ErrRebootRequired = errors.New("reboot required") )
var ( ErrInvalidInfoType = errors.New("invalid info type") ErrInvalidRaidMode = errors.New("invalid raid mode") ErrInvalidBlockSize = errors.New("invalid block size") ErrInvalidInitMode = errors.New("invalid init mode") ErrInvalidVirtualDiskID = errors.New("invalid virtual disk id") ErrDestroyVirtualDisk = errors.New("failed to destroy virtual disk") ErrCreateVirtualDisk = errors.New("failed to create virtual disk") )
var DellRepoTemplate = `` /* 1057-byte string literal not displayed */
var ErrASRRBIOSKernelModule = errors.New("error loading asrr bios kernel module")
var ErrIneffectiveWipe = errors.New("found left over data after wiping disk")
var ErrLsblkTransportUnsupported = errors.New("Unsupported transport type")
var ErrMseCliDriveNotIdentified = errors.New("failed to identify drive for update")
var (
ErrParseLshwOutput = errors.New("lshw output parse error")
)
Functions ¶
func ApplyWatermarks ¶
ApplyWatermarks applies random watermarks randomly through out the specified device/file. It returns a function that checks if the applied watermarks still exists on the device/file.
func CreateVirtualDiskError ¶
func DestroyVirtualDiskError ¶
func InvalidBlockSizeError ¶
func InvalidInfoTypeError ¶
func InvalidInitModeError ¶
func InvalidRaidModeError ¶
Types ¶
type AsrrBioscontrol ¶
type AsrrBioscontrol struct { Executor Executor // contains filtered or unexported fields }
AsrrBiosControl is a asrr-bioscontrol executor
func NewAsrrBioscontrol ¶
func NewAsrrBioscontrol(trace bool) *AsrrBioscontrol
NewAsrrBioscontrol returns a new Asrr bios control utility executor
func (*AsrrBioscontrol) Attributes ¶
func (a *AsrrBioscontrol) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
func (*AsrrBioscontrol) GetBIOSConfiguration ¶
func (a *AsrrBioscontrol) GetBIOSConfiguration(ctx context.Context, _ string) (map[string]string, error)
GetBIOSConfiguration returns a BIOS configuration object
type Blkdiscard ¶
type Blkdiscard struct {
Executor Executor
}
func NewBlkdiscardCmd ¶
func NewBlkdiscardCmd(trace bool) *Blkdiscard
Return a new blkdiscard executor
func NewFakeBlkdiscard ¶
func NewFakeBlkdiscard() *Blkdiscard
NewFakeBlkdiscard returns a mock implementation of the Blkdiscard interface for use in tests.
type CommandStatus ¶
type Controller ¶
type Controller struct { CommandStatus *CommandStatus `json:"Command Status"` ResponseData *ResponseData `json:"Response Data"` }
type DellRacadm ¶
type DellRacadm struct { Executor Executor ConfigJSON string BIOSCfgTmpFile string // where we dump the BIOS config to before processing it KeepConfigFile bool // flag to keep the BIOS config file generated (mainly for testing) }
DellRacadm is a dell racadm executor
func NewDellRacadm ¶
func NewDellRacadm(trace bool) *DellRacadm
Return a new Dell racadm command executor
func NewFakeRacadm ¶
func NewFakeRacadm(biosCfgFile string) *DellRacadm
NewFakeRacadm returns a fake lshw executor for testing
func (*DellRacadm) Attributes ¶
func (s *DellRacadm) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
func (*DellRacadm) GetBIOSConfiguration ¶
func (s *DellRacadm) GetBIOSConfiguration(ctx context.Context, deviceModel string) (map[string]string, error)
GetBIOSConfiguration returns a BIOS configuration object
type DeviceIdentifiers ¶
func IdentifyVendorModel ¶
func IdentifyVendorModel(dmidecode *Dmidecode) (*DeviceIdentifiers, error)
IdentifyVendorModel returns the device vendor, model, serial number attributes
type Dmidecode ¶
type Dmidecode struct {
// contains filtered or unexported fields
}
func InitFakeDmidecode ¶
InitFakeDmidecode returns a fake dmidecode instance loaded with the dmidecode output from testFile
func NewDmidecode ¶
func (*Dmidecode) Attributes ¶
func (d *Dmidecode) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
func (*Dmidecode) BIOSVersion ¶
BIOSVersion queries dmidecode and returns the BIOS version
func (*Dmidecode) BaseBoardManufacturer ¶
BaseBoardManufacturer queries dmidecode and returns the baseboard-manufacturer
func (*Dmidecode) BaseBoardProductName ¶
BaseBoardProductName queries dmidecode and returns the base board product name
func (*Dmidecode) BaseBoardSerialNumber ¶
BaseBoardSerialNumber queries dmidecode and returns the base board serial number
func (*Dmidecode) ChassisSerialNumber ¶
ChassisSerialNumber queries dmidecode and returns the chassis serial number
func (*Dmidecode) Manufacturer ¶
Manufacturer queries dmidecode and returns server vendor
func (*Dmidecode) ProductName ¶
ProductName queries dmidecode and returns the product name
func (*Dmidecode) SerialNumber ¶
SerialNumber queries dmidecode and returns the serial number
type Dnf ¶
type Dnf struct {
Executor Executor
}
func (*Dnf) AddRepo ¶
func (d *Dnf) AddRepo(path string, params *DnfRepoParams, _ []byte) (err error)
AddRepo sets up a dnf repo file with the given template and params
path: the directory where the repo file is created, default: "/etc/yum.repos.d/"
func (*Dnf) Attributes ¶
func (d *Dnf) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
type DnfRepoParams ¶
type Dsu ¶
type Dsu struct {
Executor Executor
}
func NewDsu ¶
NewDsu returns a executor to run dsu commands if trace is enabled, stdout is printed to the terminal
func NewFakeDsu ¶
Returns a dsu instance with a fake executor for tests
func (*Dsu) ApplyLocalUpdates ¶
ApplyLocalUpdates installs update files fetched by FetchUpdateFiles() DSU needs to be pointed to the right inventory bin or it barfs returns the resulting exitcode and error if any
func (*Dsu) ApplyUpdates ¶
ApplyUpdates installs all available updates
func (*Dsu) Attributes ¶
func (d *Dsu) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
func (*Dsu) ComponentFirmwareUpdatePreview ¶
Returns component firmware updates available based on the dell system update
func (*Dsu) FetchUpdateFiles ¶
FetchUpdateFiles executes dsu to fetch applicable updates into to local directory returns the exitcode and error if any NOTE: dsu 1.8 drops update files under the given $updateDir dsu 1.9 creates a directory '$updateDir/dellupdates' and drops the updates in there
type ExecError ¶
ExecError is returned when the command exits with an error or a non zero exit status
type Execute ¶
type Execute struct { Cmd string Args []string Env []string Stdin io.Reader CheckBin bool Quiet bool }
An execute instace
func (*Execute) CheckExecutable ¶
CheckExecutable determines if the set Cmd value exists as a file and is an executable.
func (*Execute) CmdPath ¶
CmdPath returns the absolute path to the executable this means the caller should not have disabled CheckBin.
func (*Execute) DisableBinCheck ¶
func (e *Execute) DisableBinCheck()
DisableBinCheck disables validating the binary exists and is executable
func (*Execute) SetExitCode ¶
SetExitCode doesn't do much, is around for tests
type Executor ¶
type Executor interface { Exec(context.Context) (*Result, error) SetArgs(...string) SetEnv([]string) SetQuiet() SetVerbose() GetCmd() string DisableBinCheck() SetStdin(io.Reader) CmdPath() string CheckExecutable() error // for tests SetStdout([]byte) SetStderr([]byte) SetExitCode(int) }
Executor interface lets us implement dummy executors for tests
func NewExecutor ¶
func NewFakeExecutor ¶
func NewFakeLshwExecutor ¶
NewFakeLshwExecutor returns a fake lshw executor for tests
func NewFakeRacadmExecutor ¶
NewFakeRacadmExecute returns a fake SMC sum executor for tests
func NewFakeSMCSumExecutor ¶
NewFakeSMCSumExecute returns a fake SMC sum executor for tests
func NewFakeSmartctlExecutor ¶
NewFakeSmartctlExecutor returns a fake smartctl executor for tests
type FakeExecute ¶
type FakeExecute struct { Cmd string Args []string Env []string CheckBin bool Stdin io.Reader Stdout []byte // Set this for the dummy data to be returned Stderr []byte // Set this for the dummy data to be returned Quiet bool ExitCode int }
FakeExecute implements the utils.Executor interface to enable testing
func (*FakeExecute) CheckExecutable ¶
func (e *FakeExecute) CheckExecutable() error
CheckExecutable implements the Executor interface
func (*FakeExecute) CmdPath ¶
func (e *FakeExecute) CmdPath() string
CmdPath returns the absolute path to the executable this means the caller should not have disabled CheckBin.
func (*FakeExecute) DisableBinCheck ¶
func (e *FakeExecute) DisableBinCheck()
func (*FakeExecute) Exec ¶
func (e *FakeExecute) Exec(_ context.Context) (*Result, error)
nolint:gocyclo // TODO: break this method up and move into each $util_test.go FakeExecute method returns whatever you want it to return Set e.Stdout and e.Stderr to data to be returned
func (*FakeExecute) GetCmd ¶
func (e *FakeExecute) GetCmd() string
func (*FakeExecute) SetArgs ¶
func (e *FakeExecute) SetArgs(a ...string)
func (*FakeExecute) SetEnv ¶
func (e *FakeExecute) SetEnv(env []string)
func (*FakeExecute) SetExitCode ¶
func (e *FakeExecute) SetExitCode(i int)
func (*FakeExecute) SetQuiet ¶
func (e *FakeExecute) SetQuiet()
func (*FakeExecute) SetStderr ¶
func (e *FakeExecute) SetStderr(b []byte)
func (*FakeExecute) SetStdin ¶
func (e *FakeExecute) SetStdin(r io.Reader)
func (*FakeExecute) SetStdout ¶
func (e *FakeExecute) SetStdout(b []byte)
func (*FakeExecute) SetVerbose ¶
func (e *FakeExecute) SetVerbose()
type FakeLshwExecute ¶
type FakeLshwExecute struct { Cmd string Args []string Env []string Stdin io.Reader Stdout []byte // Set this for the dummy data to be returned Stderr []byte // Set this for the dummy data to be returned Quiet bool // Executor embedded in here to skip having to implement all the utils.Executor methods Executor }
FakeLshwExecute implements the utils.Executor interface for testing
func (*FakeLshwExecute) Exec ¶
func (e *FakeLshwExecute) Exec(context.Context) (*Result, error)
Exec implements the utils.Executor interface
func (*FakeLshwExecute) SetArgs ¶
func (e *FakeLshwExecute) SetArgs(a ...string)
SetArgs is to set cmd args to the fake execute method
func (*FakeLshwExecute) SetStdin ¶
func (e *FakeLshwExecute) SetStdin(r io.Reader)
SetStdin is to set input to the fake execute method
type FakeRacadmExecute ¶
type FakeRacadmExecute struct { Cmd string Args []string Env []string Stdin io.Reader Stdout []byte // Set this for the dummy data to be returned Stderr []byte // Set this for the dummy data to be returned Quiet bool // Executor embedded in here to skip having to implement all the utils.Executor methods Executor }
FakeRacadmExecute implements the utils.Executor interface for testing
func (*FakeRacadmExecute) Exec ¶
func (e *FakeRacadmExecute) Exec(context.Context) (*Result, error)
Exec implements the utils.Executor interface
func (*FakeRacadmExecute) SetArgs ¶
func (e *FakeRacadmExecute) SetArgs(a ...string)
SetArgs is to set cmd args to the fake execute method
type FakeSMCSumExecute ¶
type FakeSMCSumExecute struct { Cmd string Args []string Env []string Stdin io.Reader Stdout []byte // Set this for the dummy data to be returned Stderr []byte // Set this for the dummy data to be returned Quiet bool // Executor embedded in here to skip having to implement all the utils.Executor methods Executor }
FakeSMCSumExecute implements the utils.Executor interface for testing
func (*FakeSMCSumExecute) Exec ¶
func (e *FakeSMCSumExecute) Exec(_ context.Context) (*Result, error)
Exec implements the utils.Executor interface
func (*FakeSMCSumExecute) GetCmd ¶
func (e *FakeSMCSumExecute) GetCmd() string
GetCmd is to retrieve the cmd args for the fake execute method
func (*FakeSMCSumExecute) SetArgs ¶
func (e *FakeSMCSumExecute) SetArgs(a ...string)
SetArgs is to set cmd args to the fake execute method
func (*FakeSMCSumExecute) SetStdin ¶
func (e *FakeSMCSumExecute) SetStdin(r io.Reader)
SetStdin is to set input to the fake execute method
type FakeSmartctlExecute ¶
type FakeSmartctlExecute struct { Cmd string Args []string Env []string Stdin io.Reader Stdout []byte // Set this for the dummy data to be returned Stderr []byte // Set this for the dummy data to be returned Quiet bool JSONFilesDir string ExitCode int CheckBin bool // Executor embedded in here to skip having to implement all the utils.Executor methods Executor }
FakeSmartctlExecute implements the utils.Executor interface for testing
func (*FakeSmartctlExecute) CheckExecutable ¶
func (e *FakeSmartctlExecute) CheckExecutable() error
CheckExecutable implements the Executor interface
func (*FakeSmartctlExecute) CmdPath ¶
func (e *FakeSmartctlExecute) CmdPath() string
func (*FakeSmartctlExecute) Exec ¶
func (e *FakeSmartctlExecute) Exec(context.Context) (*Result, error)
Exec implements the utils.Executor interface
func (*FakeSmartctlExecute) SetArgs ¶
func (e *FakeSmartctlExecute) SetArgs(a ...string)
SetArgs is to set cmd args to the fake execute method
func (*FakeSmartctlExecute) SetExitCode ¶
func (e *FakeSmartctlExecute) SetExitCode(i int)
func (*FakeSmartctlExecute) SetStdin ¶
func (e *FakeSmartctlExecute) SetStdin(r io.Reader)
SetStdin is to set input to the fake execute method
type Flashrom ¶
type Flashrom struct {
Executor Executor
}
func (*Flashrom) Attributes ¶
func (f *Flashrom) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
type Hdparm ¶
type Hdparm struct {
Executor Executor
}
func NewFakeHdparm ¶
func NewFakeHdparm() *Hdparm
NewFakeHdparm returns a mock hdparm collector that returns mock data for use in tests.
func (*Hdparm) Attributes ¶
func (h *Hdparm) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
func (*Hdparm) DriveCapabilities ¶
func (h *Hdparm) DriveCapabilities(ctx context.Context, logicalName string) ([]*common.Capability, error)
DriveCapabilities returns the capability attributes obtained through hdparm
The logicalName is the kernel/OS assigned drive name - /dev/sdX
This method implements the actions.DriveCapabilityCollector interface.
nolint:gocyclo // line parsing is cyclomatic
func (*Hdparm) Erase ¶
Erase wipes drive using ATA Secure Erase via hdparm --security-erase-enhanced
type Ipmicfg ¶
type Ipmicfg struct {
Executor Executor
}
func NewIpmicfgCmd ¶
Return a new Supermicro IPMICFG executor
func (*Ipmicfg) Attributes ¶
func (i *Ipmicfg) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
type IpmicfgSummary ¶
type Lsblk ¶
type Lsblk struct {
Executor Executor
}
func NewFakeLsblk ¶
func NewFakeLsblk() *Lsblk
NewFakeLsblk returns a mock lsblk collector that returns mock data for use in tests.
func (*Lsblk) Attributes ¶
func (l *Lsblk) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
type Lshw ¶
type Lshw struct { Executor Executor Device *common.Device // contains filtered or unexported fields }
The lshw command
func NewFakeLshw ¶
NewFakeLshw returns a fake lshw executor for testing
func (*Lshw) Attributes ¶
func (l *Lshw) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
type LshwNode ¶
type LshwNode struct { ID string `json:"id,omitempty"` Class string `json:"class,omitempty"` Claimed bool `json:"claimed,omitempty"` Handle string `json:"handle,omitempty"` Description string `json:"description,omitempty"` Product string `json:"product,omitempty"` Vendor string `json:"vendor,omitempty"` Physid string `json:"physid,omitempty"` Businfo string `json:"businfo,omitempty"` LogicalName interface{} `json:"logicalname,omitempty"` Dev string `json:"dev,omitempty"` Slot string `json:"slot,omitempty"` Units string `json:"units,omitempty"` Size float64 `json:"size,omitempty"` Capacity int64 `json:"capacity,omitempty"` Clock int64 `json:"clock,omitempty"` Version string `json:"version,omitempty"` Serial string `json:"serial,omitempty"` Width int `json:"width,omitempty"` ChildNodes []*LshwNode `json:"children,omitempty"` Configuration LshwNodeConfiguration `json:"configuration,omitempty"` Capabilities LshwNodeCapabilities `json:"capabilities,omitempty"` }
lshw -json output is unmarshalled into this struct each ChildNode is a LshwNode with almost all of the same fields https://ezix.org/project/wiki/HardwareLiSter
type LshwNodeCapabilities ¶
type LshwNodeCapabilities map[string]interface{}
fields of the ChildNodes in the lshw output theres some fields with non-string attributes, in these fields, which are currently ignored
type LshwNodeConfiguration ¶
fields of the ChildNodes in the lshw output theres some fields with non-string attributes, in these fields, which are currently ignored
type Mlxup ¶
type Mlxup struct {
Executor Executor
}
Mlxup is a mlxup command executor object
func (*Mlxup) Attributes ¶
func (m *Mlxup) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
func (*Mlxup) Query ¶
func (m *Mlxup) Query(ctx context.Context) ([]*MlxupDevice, error)
Query returns a slice of mellanox devices
func (*Mlxup) UpdateRequirements ¶
func (m *Mlxup) UpdateRequirements(_ string) *model.UpdateRequirements
UpdateRequirements implements the actions/NICUpdater interface to return any pre/post firmware install requirements.
type MlxupDevice ¶
type MlxupDevice struct { PartNumber string DeviceType string Description string PCIDeviceName string PSID string BaseMAC string Firmware []string // [version_current, version_available] FirmwarePXE []string FirmwareUEFI []string Status string }
MlxupDevice is a mellanox device object
type Msecli ¶
type Msecli struct {
Executor Executor
}
Msecli is an msecli executor
func (*Msecli) Attributes ¶
func (m *Msecli) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
type MsecliDevice ¶
type MsecliDevice struct { ModelNumber string // Micron_5200_MTFDDAK480TDN SerialNumber string FirmwareRevision string }
MseclieDevice is a Micron disk device object
type Mvcli ¶
type Mvcli struct {
Executor Executor
}
Mvcli is a mvcli command executor object
func NewFakeMvcli ¶
Return a Fake mvcli executor for tests
func (*Mvcli) Attributes ¶
func (m *Mvcli) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
func (*Mvcli) CreateVirtualDisk ¶
func (*Mvcli) DestroyVirtualDisk ¶
func (*Mvcli) FindVdBy ¶
func (m *Mvcli) FindVdBy(ctx context.Context, k string, v interface{}) *MvcliDevice
func (*Mvcli) FindVdByID ¶
func (m *Mvcli) FindVdByID(ctx context.Context, virtualDiskID int) *MvcliDevice
func (*Mvcli) FindVdByName ¶
func (m *Mvcli) FindVdByName(ctx context.Context, name string) *MvcliDevice
func (*Mvcli) StorageControllers ¶
func (*Mvcli) VirtualDisks ¶
func (m *Mvcli) VirtualDisks(ctx context.Context) ([]*MvcliDevice, error)
type MvcliDevice ¶
type MvcliDevice struct { ID int Name string Status string Product string SubProduct string Model string Serial string SupportedRAIDModes string Firmware string FirmwareRom string FirmwareBios string FirmwareBootLoader string SSDType string Type string CurrentSpeed int64 Size int64 PDSize int64 AdapterID int }
MvcliDevice is a marvell device object
type Nvme ¶
type Nvme struct {
Executor Executor
}
func NewFakeNvme ¶
func NewFakeNvme() *Nvme
NewFakeNvme returns a mock nvme collector that returns mock data for use in tests.
func (*Nvme) Attributes ¶
func (n *Nvme) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
func (*Nvme) DriveCapabilities ¶
func (n *Nvme) DriveCapabilities(ctx context.Context, logicalName string) ([]*common.Capability, error)
DriveCapabilities returns the drive capability attributes obtained through nvme
The device is the kernel/OS assigned drive name - /dev/nvmeX
This method implements the actions.DriveCapabilityCollector interface.
type ResponseData ¶
type SanitizeAction ¶
type SanitizeAction uint8
const ( Invalid SanitizeAction = iota ExitFailureMode BlockErase Overwrite CryptoErase )
func (SanitizeAction) String ¶
func (i SanitizeAction) String() string
type SecureEraseSetting ¶
type SecureEraseSetting uint8
const ( None SecureEraseSetting = iota UserDataErase CryptographicErase Reserved )
func (SecureEraseSetting) String ¶
func (i SecureEraseSetting) String() string
type ShowController ¶
type ShowController struct {
Controllers []*Controller `json:"Controllers"`
}
type Smartctl ¶
type Smartctl struct {
Executor Executor
}
func NewFakeSmartctl ¶
NewFakeSmartctl returns a fake smartctl object for testing
func (*Smartctl) Attributes ¶
func (s *Smartctl) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
type SmartctlDrive ¶
type SmartctlDriveAttributes ¶
type SmartctlDriveAttributes struct { ModelName string `json:"model_name"` OemProductID string `json:"ata_additional_product_id"` ModelFamily string `json:"model_family"` SerialNumber string `json:"serial_number"` FirmwareVersion string `json:"firmware_version"` Status *SmartctlStatus `json:"smart_status"` Errors []string `json:"-"` }
type SmartctlScan ¶
type SmartctlScan struct {
Drives []*SmartctlDrive `json:"Devices"`
}
type SmartctlStatus ¶
type SmartctlStatus struct {
Passed bool `json:"passed"`
}
type StoreCLI ¶
type StoreCLI struct {
Executor Executor
}
func NewFakeStoreCLI ¶
Return a Fake storecli executor for tests
func (*StoreCLI) Attributes ¶
func (s *StoreCLI) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
func (*StoreCLI) ShowController0 ¶
ShowController0 runs storecli to list controller 0
func (*StoreCLI) StorageControllers ¶
StorageControllers returns a slice of model.StorageControllers from the output of nvme list
type SupermicroSUM ¶
type SupermicroSUM struct {
Executor Executor
}
func NewFakeSMCIpmiCfg ¶
func NewFakeSMCIpmiCfg() *SupermicroSUM
NewFakeSMCIpmiCfg returns a fake lshw executor for testing
func NewFakeSMCSum ¶
func NewFakeSMCSum(stdin io.Reader) *SupermicroSUM
NewFakeSMCSum returns a fake lshw executor for testing
func NewSupermicroSUM ¶
func NewSupermicroSUM(trace bool) *SupermicroSUM
Return a new Supermicro sum command executor
func (*SupermicroSUM) ApplyUpdate ¶
func (s *SupermicroSUM) ApplyUpdate(ctx context.Context, updateFile, componentSlug string) error
ApplyUpdate installs the SMC update based on the component
func (*SupermicroSUM) Attributes ¶
func (s *SupermicroSUM) Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
Attributes implements the actions.UtilAttributeGetter interface
func (*SupermicroSUM) Collect ¶
func (s *SupermicroSUM) Collect(_ *common.Device) error
Collect implements the Utility interface
func (*SupermicroSUM) Components ¶
func (s *SupermicroSUM) Components() ([]*model.Component, error)
Components implements the Utility interface
func (*SupermicroSUM) GetBIOSConfiguration ¶
func (s *SupermicroSUM) GetBIOSConfiguration(ctx context.Context, _ string) (map[string]string, error)
GetBIOSConfiguration implements the Getter
func (*SupermicroSUM) UpdateBIOS ¶
func (s *SupermicroSUM) UpdateBIOS(ctx context.Context, updateFile, modelNumber string) error
UpdateBIOS installs the SMC BIOS update
type UEFIVarEntry ¶
type UEFIVariableCollector ¶
type UEFIVariableCollector struct{}
func (UEFIVariableCollector) Attributes ¶
func (UEFIVariableCollector) Attributes() (model.CollectorUtility, string, error)
func (UEFIVariableCollector) GetUEFIVars ¶
func (UEFIVariableCollector) GetUEFIVars(ctx context.Context) (UEFIVars, error)
type UEFIVars ¶
type UEFIVars map[string]UEFIVarEntry
type UefiFirmwareParser ¶
type UefiFirmwareParser struct {
Executor Executor
}
func NewUefiFirmwareParserCmd ¶
func NewUefiFirmwareParserCmd(trace bool) *UefiFirmwareParser
Return a new UefiFirmwareParser executor
func (*UefiFirmwareParser) Attributes ¶
func (u *UefiFirmwareParser) Attributes() (model.CollectorUtility, string, error)
Attributes implements the actions.UtilAttributeGetter interface
func (*UefiFirmwareParser) ExtractLogo ¶
func (u *UefiFirmwareParser) ExtractLogo(ctx context.Context, outputPath, biosImg string) error
ExtractLogo extracts the Logo BMP image. It creates the output directory if required.
Source Files ¶
- asrr_bioscontrol.go
- blkdiscard.go
- dell_racadm.go
- dmidecode.go
- dnf.go
- dsu.go
- errors.go
- executor.go
- fake_executor.go
- fill_zero.go
- flashrom.go
- hdparm.go
- lsblk.go
- lshw.go
- misc.go
- mlxup.go
- msecli.go
- mvcli.go
- normalizer.go
- nvme.go
- sanitizeaction_string.go
- secureerasesetting_string.go
- smartctl.go
- smc_ipmicfg.go
- smc_sum.go
- storecli.go
- uefi_firmware_parser.go
- uefi_vars.go
- watermark_disk.go