utils

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2016 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package utils contains logquiet

Package utils contains helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachToSerial

func AttachToSerial(serverID string, apiToken string) (*gottyclient.Client, chan bool, error)

AttachToSerial tries to connect to server serial using 'gotty-client' and fallback with a help message

func GeneratingAnSSHKey

func GeneratingAnSSHKey(cfg SpawnRedirection, path string, name string) (string, error)

GeneratingAnSSHKey generates an SSH key

func IsTCPPortOpen

func IsTCPPortOpen(dest string) bool

IsTCPPortOpen returns true if a TCP communication with "host:port" can be initialized

func LogQuiet

func LogQuiet(str string)

LogQuiet Displays info if quiet is activated

func NewSSHExecCmd

func NewSSHExecCmd(publicIPAddress string, privateIPAddress string, allocateTTY bool, command []string, gatewayIPAddress string) *sshcommand.Command

NewSSHExecCmd computes execve compatible arguments to run a command via ssh

func PathToTARPathparts

func PathToTARPathparts(fullPath string) (string, string)

PathToTARPathparts returns the two parts of a unix path

func Quiet

func Quiet(option bool)

Quiet enable or disable quiet

func RemoveDuplicates

func RemoveDuplicates(elements []string) []string

RemoveDuplicates transforms an array into a unique array

func SSHExec

func SSHExec(publicIPAddress string, privateIPAddress string, command []string, checkConnection bool, gateway string) error

SSHExec executes a command over SSH and redirects file-descriptors

func SSHGetFingerprint added in v1.5.0

func SSHGetFingerprint(key []byte) (string, error)

SSHGetFingerprint returns the fingerprint of an SSH key

func TruncIf

func TruncIf(str string, max int, cond bool) string

TruncIf ensures the input string does not exceed max size if cond is met

func WaitForTCPPortOpen

func WaitForTCPPortOpen(dest string) error

WaitForTCPPortOpen calls IsTCPPortOpen in a loop

func Wordify

func Wordify(str string) string

Wordify convert complex name to a single word without special shell characters

Types

type LogQuietStruct

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

LogQuietStruct is a struct to store information about quiet state

type SpawnRedirection

type SpawnRedirection struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

SpawnRedirection is used to redirects the fluxes

Jump to

Keyboard shortcuts

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