utils

package
v21.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseFolder  = "/opt/safescale"     // is the path of the base folder containing safescale data on cloud provider instances
	EtcFolder   = BaseFolder + "/etc"  // is the path of the folder containing safescale configurations
	BinFolder   = BaseFolder + "/bin"  // is the path of the folder containing safescale binaries on cloud provider instances
	VarFolder   = BaseFolder + "/var"  // is the path of the folder containing safescale equivalent of /var
	LogFolder   = VarFolder + "/log"   // is the path of the folder containing safescale logs
	TempFolder  = VarFolder + "/tmp"   // is the path of the folder containing safescale temporary files
	StateFolder = VarFolder + "/state" // is the path of the folder containing safescale states
)

Variables

This section is empty.

Functions

func AbsPathify

func AbsPathify(inPath string) string

AbsPathify ...

func ExtractRetCode

func ExtractRetCode(err error) (_ string, _ int, ferr fail.Error)

ExtractRetCode extracts info from the error

func GeneratePassword

func GeneratePassword(length uint8) (string, error)

GeneratePassword generates a password with length at least 12

func IsEmpty

func IsEmpty(v interface{}) bool

IsEmpty checks whether v is an empty struct Note:because IsEmpty uses reflect package, it may be slow. Use with parsimony

func LazyRemove

func LazyRemove(path string) fail.Error

LazyRemove is identical to os.Remove, but doesn't raise an error, and log.Warn every error except "file not found" which is ignored

func UserConfirmed

func UserConfirmed(msg string) bool

UserConfirmed asks user to confirm

Types

type Valid added in v21.11.1

type Valid interface {
	OK() bool
}

Valid interface is used to check data validity

Jump to

Keyboard shortcuts

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