utils

package
v0.0.0-...-88aa921 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2015 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Rhel = iota
	Debian
)

Variables

View Source
var Platform = determinePlatform()

Functions

func AttachAndExec

func AttachAndExec(containerID string, bashcmd []string) error

AttachAndExec attaches to a container and execs the command

func AttachAndRun

func AttachAndRun(containerID string, bashcmd []string) ([]byte, error)

AttachAndRun attaches to a container and runs the command

func BackupDir

func BackupDir(basepath string) string

BackupDir gets the directory where backup files are stored

func ConvertUp

func ConvertUp(oldNumber string, baseAlphabet string) string

ConvertUp converts a hexadecimal UUID string to a base alphabet greater than 16.

func DockerIsLoggedIn

func DockerIsLoggedIn() bool

func DockerLogin

func DockerLogin(username, password, email string) (string, error)

func ExecDockerExec

func ExecDockerExec(containerID string, bashcmd []string) error

ExecDockerExec execs the command using docker exec

func GetExitStatus

func GetExitStatus(err error) (int, bool)

GetExitStatus tries to extract the exit code from an error

func GetIPAddress

func GetIPAddress() (ip string, err error)

GetIPAddress attempts to find the IP address to the default outbout interface.

func GetIPv4Addresses

func GetIPv4Addresses() (ips []string, err error)

GetIPAddresses returns a list of all IPv4 interface addresses

func GetMemorySize

func GetMemorySize() (size uint64, err error)

GetMemorySize attempts to get the size of the installed RAM.

func HostID

func HostID() (hostid string, err error)

HostID retreives the system's unique id, on linux this maps to /usr/bin/hostid.

func Isatty

func Isatty(f *os.File) bool

Isatty returns true if f is a TTY, false otherwise.

func LocalDir

func LocalDir(p string) string

LocalDir gets the absolute path to a particular directory under ServiceDHome if SERVICED_HOME is not defined then we use the location of the caller

func NewUUID

func NewUUID() (string, error)

NewUUID generate a new UUID

func NewUUID36

func NewUUID36() (string, error)

NewUUID36 returns a base-36 UUID with no dashes.

func NewUUID62

func NewUUID62() (string, error)

NewUUID62 returns a base-36 UUID with no dashes.

func ResourcesDir

func ResourcesDir() string

ResourcesDir points to internal services resources directory

func RunDockerExec

func RunDockerExec(containerID string, bashcmd []string) ([]byte, error)

RunDockerExec runs the command using docker exec

func ServiceDHome

func ServiceDHome() string

ServiceDHome gets the home location of serviced by looking at the enviornment

func ServicedLogDir

func ServicedLogDir() string

ServicedLogDir gets the serviced log directory

func SetSysctl

func SetSysctl(key string, value string) ([]byte, error)

SetSysctl tries to set sysctl settings

func ShellQuoteArg

func ShellQuoteArg(arg string) string

Quote a single argument

func ShellQuoteArgs

func ShellQuoteArgs(args []string) string

Quote a list of arguments and join them with spaces

func StringInSlice

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

StringInSlice test if a string exists in a slice

func StringSliceEquals

func StringSliceEquals(lhs []string, rhs []string) bool

StringSliceEquals compare two string slices for equality

func TempDir

func TempDir(p string) string

TempDir gets the temp serviced directory

Types

type EngNotation

type EngNotation struct {
	Value uint64
	// contains filtered or unexported fields
}

Structure used for serializing/deserializing values represented as strings in engineering notation (e.g., 1K, 256M, etc.)

func (EngNotation) MarshalJSON

func (i EngNotation) MarshalJSON() (text []byte, err error)

func (*EngNotation) UnmarshalJSON

func (e *EngNotation) UnmarshalJSON(b []byte) (err error)

type RouteEntry

type RouteEntry struct {
	Destination string
	Gateway     string
	Genmask     string
	Flags       string
	Metric      int
	Ref         int
	Use         int
	Iface       string
}

RouteEntry represents a entry from the route command

func RouteCmd

func RouteCmd() (routes []RouteEntry, err error)

RouteCmd wrapper around the route command

Jump to

Keyboard shortcuts

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