utils

package
v0.0.0-...-cea9070 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2016 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgsToCmd

func ArgsToCmd(args []string) *exec.Cmd

func ExecuteAndWait

func ExecuteAndWait(cmd *exec.Cmd) (int, error)

ExecuteAndWait runs the given command and blocks until completed

func GetIP

func GetIP(specList []string) (string, error)

GetIP determines the IP address of the container

func IpFromInterfaces

func IpFromInterfaces(raw json.RawMessage) (string, error)

func NewLogWriter

func NewLogWriter(fields log.Fields, level log.Level) io.WriteCloser

NewLogWriter pipes stdout/err logs to logrus

func ParseCommandArgs

func ParseCommandArgs(raw json.RawMessage) (*exec.Cmd, error)

func ParseDuration

func ParseDuration(duration interface{}) (time.Duration, error)

ParseDuration parses the given duration with multiple type support int (defaults to seconds) string with units string without units (default to seconds)

func ParseInterfaces

func ParseInterfaces(raw json.RawMessage) ([]string, error)

func Run

func Run(cmd *exec.Cmd) (int, error)

Run executes the given command and blocks until completed Returns the exit code and error message (if any). Logs output streams to the log driver instead of stdout/stderr - stderr creates DEBUG level entries - stdout creates INFO level entries

func RunWithFields

func RunWithFields(cmd *exec.Cmd, fields log.Fields) (int, error)

RunWithFields executes the given command and blocks until completed Returns the exit code and error message (if any). Logs output streams to the log driver instead of stdout/stderr - stderr creates DEBUG level entries - stdout creates INFO level entries Adds the given fields to the log entries

func StrToCmd

func StrToCmd(command string) *exec.Cmd

Types

type ByInterfaceThenIP

type ByInterfaceThenIP []interfaceIP

ByInterfaceThenIP implements the Sort with the following properties: 1. Sort interfaces alphabetically 2. Sort IPs by bytes (normalized to 16 byte form)

func (ByInterfaceThenIP) Len

func (se ByInterfaceThenIP) Len() int

func (ByInterfaceThenIP) Less

func (se ByInterfaceThenIP) Less(i, j int) bool

func (ByInterfaceThenIP) Swap

func (se ByInterfaceThenIP) Swap(i, j int)

Jump to

Keyboard shortcuts

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