Documentation
¶
Index ¶
- Constants
- Variables
- func AddDebugFlag()
- func AddLogLevelFlag()
- func AddModels(parent *spec.Models, child *spec.Models)
- func AddTokenFlag()
- func CheckPortInUse(port string) bool
- func ConvertSpecToModels(commandSpec spec.ExpModelCommandSpec, prepare spec.ExpPrepareModel, ...) *spec.Models
- func CreateYamlFile(models *spec.Models, specFile string) error
- func Curl(url string) (string, error, int)
- func GenerateUid() (string, error)
- func GetBinPath() string
- func GetLibHome() string
- func GetLogFile(programType int) (string, error)
- func GetLogPath(programType int) (string, error)
- func GetNohupOutput(programType int, logFileName string) string
- func GetProgramParentPath() string
- func GetProgramPath() string
- func GetSpecifyingUserHome(username string) string
- func GetUnusedPort() (int, error)
- func GetUserHome() string
- func GetYamlHome() string
- func Hold(hooks ...ShutdownHook)
- func InitLog(programType int)
- func IsDir(path string) bool
- func IsExist(fileName string) bool
- func IsNil(i interface{}) bool
- func MarshalModelSpec(models *spec.Models, writer io.Writer) error
- func MergeModels(models ...*spec.Models) *spec.Models
- func ParseIntegerListToStringSlice(flagValue string) ([]string, error)
- func ParseSpecsToModel(file string, executor spec.Executor) (*spec.Models, error)
- func PostCurl(url string, body []byte, contentType string) (string, error, int)
- func Remove(items []string, idx int) []string
- func RemoveDuplicates(items []string) []string
- type ShutdownHook
Constants ¶
const ( Blade = 1 Bin = 2 )
const BladeLog = "chaosblade.log"
Variables ¶
var ( Debug bool LogLevel string )
var (
Token string
)
Functions ¶
func AddDebugFlag ¶
func AddDebugFlag()
func AddLogLevelFlag ¶
func AddLogLevelFlag()
func AddTokenFlag ¶
func AddTokenFlag()
func CheckPortInUse ¶
CheckPortInUse returns true if the port is in use, otherwise returns false.
func ConvertSpecToModels ¶
func ConvertSpecToModels(commandSpec spec.ExpModelCommandSpec, prepare spec.ExpPrepareModel, scope string) *spec.Models
ConvertSpecToModels converts the spec.ExpModelCommandSpec to spec.Models
func CreateYamlFile ¶
CreateYamlFile converts the spec.Models to spec file
func GetLogPath ¶
func GetNohupOutput ¶
GetNohupOutput
func GetProgramParentPath ¶
func GetProgramParentPath() string
GetProgramParentPath returns the parent directory end with /
func GetSpecifyingUserHome ¶
GetSpecifyingUserHome
func GetUnusedPort ¶
func GetYamlHome ¶
func GetYamlHome() string
func Hold ¶
func Hold(hooks ...ShutdownHook)
func MarshalModelSpec ¶
MarshalModelSpec marshals the spec.Models to bytes and output to writer
func ParseIntegerListToStringSlice ¶
ParseIntegerListToStringSlice func parses the multiple integer values to string slice. Support the below formats: 0 | 0,1 | 0,2,3 | 0-3 | 0,2-4 | 0,1,3-5 For example, the flag value is 0,2-3, the func returns []string{"0", "2", "3"}
func ParseSpecsToModel ¶
ParseSpecsToModel parses the yaml file to spec.Models and set the executor to the spec.Models
func RemoveDuplicates ¶
Types ¶
type ShutdownHook ¶
type ShutdownHook interface {
Shutdown() error
}