utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeMetaDataFile = "/host/etc/cds/node-meta"
)

Variables

This section is empty.

Functions

func CreateDir

func CreateDir(target string, mode int) error

CreateDir create the target directory with error handling

func FileExisted

func FileExisted(filename string) bool

FileExisted checks if a file or directory exists

func IsDir

func IsDir(path string) bool

IsDir checks if the target path is directory

func Mounted

func Mounted(mountPath string) bool

Mounted checks whether a volume is mounted

func RunCommand

func RunCommand(cmd string) (string, error)

RunCommand runs a given shell command

func SentrySendError added in v1.4.0

func SentrySendError(errorInfo error)

func ServerReachable

func ServerReachable(host, port string, timeout time.Duration) bool

ServerReachable tests whether a server is connection using TCP

func Unmount

func Unmount(mountPath string) error

Unmount tries to unmount a device from the node

func WaitTimeout

func WaitTimeout(wg *sync.WaitGroup, timeout int) bool

WaitTimeOut waits for a mount of time before continues

Types

type NodeMeta

type NodeMeta struct {
	NodeID string `json:"node_id"`
}

func GetNodeMetadata

func GetNodeMetadata() *NodeMeta

GetNodeId reads node metadata from file

func (*NodeMeta) GetNodeID

func (n *NodeMeta) GetNodeID() string

Jump to

Keyboard shortcuts

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