util

package
v0.0.0-...-a58d3e8 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: Apache-2.0 Imports: 20 Imported by: 34

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildEmptyDataVolume

func BuildEmptyDataVolume(size unikos.MegaBytes) (string, error)

func BuildEmptyDataVolumeWithType

func BuildEmptyDataVolumeWithType(size unikos.MegaBytes, volType string) (string, error)

func BuildRawDataImage

func BuildRawDataImage(dataTar io.ReadCloser, size unikos.MegaBytes, usePartitionTables bool) (string, error)

func BuildRawDataImageWithType

func BuildRawDataImageWithType(dataTar io.ReadCloser, size unikos.MegaBytes, volType string, usePartitionTables bool) (string, error)

func GetToolboxMountPath

func GetToolboxMountPath(path string) string

func InitContainers

func InitContainers() error

func IsDockerToolbox

func IsDockerToolbox() bool

func LogCommand

func LogCommand(cmd *exec.Cmd, asDebug bool)

func ReaderWithProgress

func ReaderWithProgress(r io.Reader, total int64) io.Reader

func Redact

func Redact(str, substr string) string

func Retry

func Retry(retries int, sleep time.Duration, action func() error) error

func StringInSlice

func StringInSlice(a string, list []string) bool

Types

type AddTraceHook

type AddTraceHook struct {
	Full bool
}

func (*AddTraceHook) Fire

func (h *AddTraceHook) Fire(entry *logrus.Entry) error

func (*AddTraceHook) Levels

func (h *AddTraceHook) Levels() []logrus.Level

type Container

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

func NewContainer

func NewContainer(imageName string) *Container

func (*Container) BuildCmd

func (c *Container) BuildCmd(arguments ...string) *exec.Cmd

func (*Container) CombinedOutput

func (c *Container) CombinedOutput(arguments ...string) ([]byte, error)

func (*Container) Interactive

func (c *Container) Interactive(i bool) *Container

func (*Container) Output

func (c *Container) Output(arguments ...string) ([]byte, error)

func (*Container) Privileged

func (c *Container) Privileged(p bool) *Container

func (*Container) Run

func (c *Container) Run(arguments ...string) error

func (*Container) Stop

func (c *Container) Stop() error

func (*Container) WithEntrypoint

func (c *Container) WithEntrypoint(entrypoint string) *Container

func (*Container) WithEnv

func (c *Container) WithEnv(key, value string) *Container

func (*Container) WithEnvs

func (c *Container) WithEnvs(vars map[string]string) *Container

func (*Container) WithName

func (c *Container) WithName(name string) *Container

func (*Container) WithNet

func (c *Container) WithNet(net string) *Container

func (*Container) WithVolume

func (c *Container) WithVolume(hostdir, containerdir string) *Container

func (*Container) WithVolumes

func (c *Container) WithVolumes(vols map[string]string) *Container

type RedactedTextFormatter

type RedactedTextFormatter struct {
	// Set to true to bypass checking for a TTY before outputting colors.
	ForceColors bool

	// Force disabling colors.
	DisableColors bool

	// Disable timestamp logging. useful when output is redirected to logging
	// system that already adds timestamps.
	DisableTimestamp bool

	// Enable logging the full timestamp when a TTY is attached instead of just
	// the time passed since beginning of execution.
	FullTimestamp bool

	// TimestampFormat to use for display when a full timestamp is printed
	TimestampFormat string

	// The fields are sorted by default for a consistent output. For applications
	// that log extremely frequently and don't use the JSON formatter this may not
	// be desired.
	DisableSorting bool

	// Redactions specifies sensitive strings that should be redacted (replaced
	// with *'s) in all outputs.
	Redactions []string
}

func (*RedactedTextFormatter) Format

func (f *RedactedTextFormatter) Format(entry *logrus.Entry) ([]byte, error)

type TeeHook

type TeeHook struct {
	W io.Writer
}

func (*TeeHook) Fire

func (h *TeeHook) Fire(entry *logrus.Entry) error

func (*TeeHook) Levels

func (h *TeeHook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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