utils

package
v22.11.9 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 12 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 CreateTempFileFromString

func CreateTempFileFromString(content string, filemode os.FileMode) (*os.File, fail.Error)

CreateTempFileFromString creates a temporary file containing 'content'

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

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

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