Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type Command
- func (c *Command) AddCmdEnv(env map[string]string)
- func (c *Command) AddDetectEnv(env map[string]string)
- func (c *Command) CheckErrOutput() string
- func (c *Command) CheckOutput() string
- func (c *Command) ErrOutput() string
- func (c *Command) Name() string
- func (c *Command) Output() string
- func (c *Command) RollbackErrOutput() string
- func (c *Command) RollbackOutput() string
- func (c *Command) Status() CommandStatus
- func (c *Command) StatusName() string
- type CommandStatus
- type Env
Constants ¶
View Source
const ( //AuthTypePassword is the type of ssh by password AuthTypePassword authType = iota //AuthTypePublicKey is the type of ssh by public key AuthTypePublicKey )
View Source
const ( //RollbackTypeNone means no rollback RollbackTypeNone rollbackType = iota //RollbackTypeOne means just rollback single command,yet last failed one RollbackTypeOne //RollbackTypeBackTrace means rollback backtrack util one without rollback or the first one RollbackTypeBackTrace //RollbackTypeAll which is recommended is rollback all,this requires that each command should have rollback command RollbackTypeAll )
Variables ¶
View Source
var ( //ErrEmptyCommand defines empty command error ErrEmptyCommand = errors.New("empty command") //ErrRollbackTypeAllWithNoRollbackCmd defines rollback type all with no rollback command ErrRollbackTypeAllWithNoRollbackCmd = errors.New("rollback type all with no rollback command") //ErrRunWithEmptyCommand defines run with empty command ErrRunWithEmptyCommand = errors.New("run with empty command") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a single ssh client
func NewClientByPassword ¶
NewClientByPassword creates client by password
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command defines command for run
func NewCommand ¶
func NewCommand(name, cmd, checkCmd, rollbackCmd string, checkExpectResult string, cmdEnv, checkEnv, rollbackEnv map[string]string, timeout time.Duration) *Command
NewCommand will get a new command by input info
func (*Command) AddDetectEnv ¶
AddDetectEnv is used for add check cmd environment variables
func (*Command) CheckErrOutput ¶
func (*Command) CheckOutput ¶
func (*Command) RollbackErrOutput ¶
func (*Command) RollbackOutput ¶
func (*Command) StatusName ¶
StatusName will get Command's status in string
type CommandStatus ¶
type CommandStatus byte
CommandStatus defines command status
const ( //CommandStatusInit is the default command status CommandStatusInit CommandStatus = iota //CommandStatusSuccess means this command runs successfully CommandStatusSuccess //CommandStatusFailed means this command runs failed,and with no rollback CommandStatusFailed //CommandStatusRollbackSuccess means the command runs failed,the rollback command runs successfully CommandStatusRollbackSuccess //CommandStatusRollbackFailed means both the command and rollback command run failed CommandStatusRollbackFailed //CommandStatusCheckFailed means check cmd runs failed CommandStatusCheckFailed //CommandStatusCheckSuccess means check cmd runs successfully CommandStatusCheckSuccess )
Click to show internal directories.
Click to hide internal directories.