internal

package
v0.0.0-...-99fe1a5 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInput         = errors.New("bad program input")
	ErrPermissions   = errors.New("bad permissions")
	ErrRegistered    = errors.New("host is registered")
	ErrNotRegistered = errors.New("host is not registered")
)
View Source
var ArchiveDirectoryParentPath = "/var/cache/insights-client/"

ArchiveDirectoryParentPath is a parent directory for archive directories.

View Source
var ConfigPath = "/etc/insights-client/insights-client.conf"

ConfigPath points to a file where a configuration file is stored.

View Source
var DefaultModuleName = "advisor"

DefaultModuleName is run when CLI did not specify anything else.

View Source
var DotRegisteredPath = "/etc/insights-client/.registered"
View Source
var DotUnregisteredPath = "/etc/insights-client/.unregistered"
View Source
var LogPath = "/var/log/insights-client/insights-client.log"

LogPath points to a file into which logs should be written.

View Source
var MachineIDFilePath = "/etc/insights-client/machine-id"

MachineIDFilePath points to a file where the client UUID is stored.

View Source
var TagsPath = "/etc/insights-client/tags.yaml"
View Source
var Version = "development"

Functions

func ClearConfiguration

func ClearConfiguration()

ClearConfiguration clears the configuration cached in memory.

func ParseFormat

func ParseFormat(format string) (Format, IError)

ParseFormat converts a string into a Format.

If parsing fails, returns `Human` and an error.

Types

type ColorHandler

type ColorHandler struct {
	slog.Handler
	// contains filtered or unexported fields
}

func NewColorHandler

func NewColorHandler(out io.Writer, opts *slog.HandlerOptions) *ColorHandler

func (*ColorHandler) Handle

func (handler *ColorHandler) Handle(_ context.Context, record slog.Record) error

type Configuration

type Configuration struct {
	APIProtocol         string        `config:"api_protocol"`
	APIHost             string        `config:"api_host"`
	APIPort             uint          `config:"api_port"`
	HTTPTimeout         time.Duration `config:"http_timeout"`
	LogLevel            slog.Level    `config:"loglevel"`
	IdentityCertificate string        `config:"identity_certificate"`
	IdentityKey         string        `config:"identity_key"`
	CACertificate       string        `config:"ca_certificate"`
}

func GetConfiguration

func GetConfiguration() Configuration

GetConfiguration loads configuration from a filesystem.

It caches its value internally, so it can be called multiple times with no overhead. Call ClearConfiguration to force reload.

type Error

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

Error is a complex, translatable error object.

func NewError

func NewError(typ, original error, human string) *Error

NewError creates a high-level error object.

`typ` is the high-level error defined by the library itself.

`original` is the originally raised error; may be `nil`.

`human` is human-readable, translatable error message displayed to the user.

func (*Error) Error

func (e *Error) Error() string

Error returns complex message created from both the internal type and external reason.

func (*Error) Human

func (e *Error) Human() string

Human returns the human-readable version of an error.

func (*Error) Is

func (e *Error) Is(err error) bool

Is compares an input error with the internal error type.

type FileHandler

type FileHandler struct {
	slog.Handler
	// contains filtered or unexported fields
}

func NewFileHandler

func NewFileHandler(out io.Writer, opts *slog.HandlerOptions) *FileHandler

func (*FileHandler) Handle

func (handler *FileHandler) Handle(_ context.Context, record slog.Record) error

type Format

type Format uint8
const (
	Human Format = iota
	JSON
)

func MustParseFormat

func MustParseFormat(format string) Format

MustParseFormat converts a string into a Format.

If parsing fails, returns `Human`.

type IError

type IError interface {
	Error() string
	Is(error) bool
	Human() string
}

func CompressDirectory

func CompressDirectory(directory string) (string, IError)

func CompressDirectoryToPath

func CompressDirectoryToPath(directory, archive string) (string, IError)

func ReadRHSMIdentity

func ReadRHSMIdentity(filename string) (string, IError)

ReadRHSMIdentity reads the CommonName from x.509 certificate.

It loads the subscription-manager UUID.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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