util

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src string, dst string) error

CopyFile copies both files and directories

func CreateDirectories

func CreateDirectories() error

Creates the /var/lib/firecracker/{vm,image,kernel} directories

func DeferErr added in v0.5.1

func DeferErr(err *error, f func() error)

This is a light weight handler to capture errors during detach that would otherwise be silently ignored. Pass a pointer to the error to be returned and the function to run. TODO: Replace all ignored defers with this

func DirEmpty added in v0.6.0

func DirEmpty(dirname string) (b bool)

func DirExists

func DirExists(dirname string) bool

func ExecForeground

func ExecForeground(command string, args ...string) (int, error)

func ExecuteCommand

func ExecuteCommand(command string, args ...string) (string, error)

func FIPSEnabled added in v0.4.1

func FIPSEnabled() bool

FIPSEnabled returns true if running in FIPS mode. currently it just checks the system wide /etc/system-fips file present or not. TODO - Find a better generic solution for this.

func FileExists

func FileExists(filename string) bool

func FileIsEmpty

func FileIsEmpty(file string) (bool, error)

FileIsEmpty returns true if the file is empty

func GenericCheckErr added in v0.5.0

func GenericCheckErr(err error)

GenericCheckErr is used by the commands to check if the action failed and respond with a fatal error provided by the logger (calls os.Exit) Ignite has its own, more detailed implementation of this in cmdutil

func IsDeviceFile added in v0.5.0

func IsDeviceFile(filename string) (err error)

func IsEmptyString

func IsEmptyString(input string) bool

func MaxInt added in v0.5.0

func MaxInt(a, b int) int

func NewMAC

func NewMAC(buffer *[]string) error

Fills the given string slice with unique MAC addresses

func NewOutput

func NewOutput() *output

func NewUID added in v0.6.0

func NewUID() (s string, err error)

func PathExists

func PathExists(path string) (bool, os.FileInfo)

func RandomName

func RandomName() string

func TestRoot added in v0.3.0

func TestRoot() error

func ToLower added in v0.6.1

func ToLower(a []string) []string

func WriteFileIfChanged added in v0.6.1

func WriteFileIfChanged(filename string, data []byte, perm os.FileMode) error

WriteFileIfChanged stores a sha of data at <filename>.sha256 and determines whether to rewrite the file; it has the same signature as ioutil.WriteFile().

Types

type MountPoint

type MountPoint struct {
	Path string
}

func Mount

func Mount(volume string) (*MountPoint, error)

func (*MountPoint) Umount

func (mp *MountPoint) Umount() error

type Prefixer added in v0.4.0

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

func NewPrefixer added in v0.4.0

func NewPrefixer(idPrefix string) *Prefixer

NewPrefixer returns an immutable prefixer for a specific purpose ex: idPrefix is used to prefix vm, container, and snapshot file/device names

func (*Prefixer) Prefix added in v0.4.0

func (p *Prefixer) Prefix(input ...interface{}) string

Jump to

Keyboard shortcuts

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