facts

package
v0.0.0-...-1bee359 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2025 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package facts provides facts about the system

Index

Constants

This section is empty.

Variables

View Source
var Facts facts

Facts holds facts about the system

Functions

func DistroAlpine

func DistroAlpine() bool

DistroAlpine - return true if we are on alpine distro

func DistroArch

func DistroArch() bool

DistroArch - return true if we are on an Arch Linux distro

func DistroFedora

func DistroFedora() bool

DistroFedora - return true if we are on a Fedora distro

func DistroRHEL

func DistroRHEL() bool

DistroRHEL - return true if we are on a Red Hat Enterprise Linux distro

func DistroUbuntu

func DistroUbuntu() bool

DistroUbuntu - return true if we are on a Ubuntu distro

func GetCPUInfo

func GetCPUInfo()

GetCPUInfo - fill in CPUInfo struct

func GetCephLVMVolumes

func GetCephLVMVolumes() (map[string][]CephLVMVolume, error)

GetCephLVMVolumes retrieves Ceph LVM volume information

func GetStorageFactsInfo

func GetStorageFactsInfo()

func GetSystemUUID

func GetSystemUUID() string

GetSystemUUID - return/fill in the system UUID TODO if we can't find one, generate our own and store it in our cache dir

Types

type CPUInfoFacts

type CPUInfoFacts struct {
	Arch         string // amd64/etc
	ArchArch     string // x86_64/etc (i.e. the output you'd get from the arch binary)
	FeatureLevel string // v1/v2/v3/v4 equivalent to $GOAMD64 TODO
	Vendor       string
	Model        string
	Cores        int
	Threads      int
	Flags        []string
}

CPUInfoFacts - info about the CPU(s) in the system

type CephFacts

type CephFacts struct {
	LVMVolumes map[string][]CephLVMVolume // Map of OSD ID to volumes
	OSDs       []CephOSD                  // Parsed OSD information
}

CephFacts contains facts about Ceph storage

func (*CephFacts) ParseOSDs

func (cf *CephFacts) ParseOSDs()

ParseOSDs converts the LVM volumes map into a structured list of OSDs

type CephLVMVolume

type CephLVMVolume struct {
	Devices []string       `json:"devices"`
	LVName  string         `json:"lv_name"`
	LVPath  string         `json:"lv_path"`
	LVSize  string         `json:"lv_size"`
	LVTags  string         `json:"lv_tags"`
	LVUUID  string         `json:"lv_uuid"`
	Name    string         `json:"name"`
	Path    string         `json:"path"`
	Tags    CephVolumeTags `json:"tags"`
	Type    string         `json:"type"`
	VGName  string         `json:"vg_name"`
}

CephLVMVolume represents a single LVM volume used by Ceph

type CephOSD

type CephOSD struct {
	ID      int
	Volumes []CephLVMVolume
}

CephOSD represents a Ceph OSD and its associated volumes

func (*CephOSD) GetBlockVolume

func (osd *CephOSD) GetBlockVolume() *CephLVMVolume

GetBlockVolume returns the block volume for an OSD (if it exists)

func (*CephOSD) GetDBVolume

func (osd *CephOSD) GetDBVolume() *CephLVMVolume

GetDBVolume returns the DB volume for an OSD (if it exists)

func (*CephOSD) GetWALVolume

func (osd *CephOSD) GetWALVolume() *CephLVMVolume

GetWALVolume returns the WAL volume for an OSD (if it exists)

type CephVolumeTags

type CephVolumeTags struct {
	BlockDevice        string `json:"ceph.block_device"`
	BlockUUID          string `json:"ceph.block_uuid"`
	CephxLockboxSecret string `json:"ceph.cephx_lockbox_secret"`
	ClusterFSID        string `json:"ceph.cluster_fsid"`
	ClusterName        string `json:"ceph.cluster_name"`
	CrushDeviceClass   string `json:"ceph.crush_device_class"`
	DBDevice           string `json:"ceph.db_device"`
	DBUUID             string `json:"ceph.db_uuid"`
	Encrypted          string `json:"ceph.encrypted"`
	OSDFSID            string `json:"ceph.osd_fsid"`
	OSDID              string `json:"ceph.osd_id"`
	OSDSpecAffinity    string `json:"ceph.osdspec_affinity"`
	Type               string `json:"ceph.type"`
	VDO                string `json:"ceph.vdo"`
	WALDevice          string `json:"ceph.wal_device"`
	WALUUID            string `json:"ceph.wal_uuid"`
}

CephVolumeTags contains parsed Ceph tags from LVM volumes

type DiskInfo

type DiskInfo struct {
	Name       string // (sda, nvme0, vda, etc)
	MountPoint string // where it's mounted
}

type DistroFacts

type DistroFacts struct {
	Name       string
	Slug       string
	Family     string
	Version    string
	Codename   string
	InitSystem string
}

DistroFacts - holds distro information

type NetworkFacts

type NetworkFacts struct {
	// TODO
	// HasEthernet bool  // can be used to only install ethernet packages on systems with ethernet, etc
	// HasFibre?
	// HasWifi?
	// HasBluetooth?
	Interfaces []net.Interface
}

NetworkFacts contains facts about the network

type ServiceFacts

type ServiceFacts struct {
	InstalledServices []string
	RunningServices   []string
}

ServiceFacts contains facts about the system services

type StorageFacts

type StorageFacts struct {
	LocalDisks []DiskInfo // list of local disks

}

func (*StorageFacts) GetRoot

func (f *StorageFacts) GetRoot() (*DiskInfo, error)

Jump to

Keyboard shortcuts

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