exec

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInstallPath = "/opt/chaosblade"
	BladeBin           = "blade"
	DefaultSSHPort     = 22
	BladeReleaseURL    = "https://chaosblade.oss-cn-hangzhou.aliyuncs.com/agent/github/%s/chaosblade-%s-linux-amd64.tar.gz"
)

Variables

View Source
var BladeRelease = &spec.ExpFlag{
	Name:     "blade-release",
	Desc:     "Blade release package,use this flag when the channel is ssh",
	NoArgs:   false,
	Required: false,
}
View Source
var ChannelFlag = &spec.ExpFlag{
	Name:     "channel",
	Desc:     "Select the channel for execution, and you can now select SSH",
	NoArgs:   false,
	Required: false,
}

support ssh channel flags

View Source
var InstallPath = &spec.ExpFlag{
	Name:     "install-path",
	Desc:     "install path default /opt/chaosblade,use this flag when the channel is ssh",
	NoArgs:   false,
	Required: false,
}
View Source
var OverrideBladeRelease = &spec.ExpFlag{
	Name:     "override-blade-release",
	Desc:     "Override blade release,use this flag when the channel is ssh",
	NoArgs:   true,
	Required: false,
}
View Source
var SSHHostFlag = &spec.ExpFlag{
	Name:     "ssh-host",
	Desc:     "Use this flag when the channel is ssh",
	NoArgs:   false,
	Required: false,
}
View Source
var SSHKeyFlag = &spec.ExpFlag{
	Name:     "ssh-key",
	Desc:     "Use this flag when the channel is ssh",
	NoArgs:   false,
	Required: false,
}
View Source
var SSHKeyPassphraseFlag = &spec.ExpFlag{
	Name:     "ssh-key-passphrase",
	Desc:     "Use this flag when the channel is ssh",
	NoArgs:   true,
	Required: false,
}
View Source
var SSHPortFlag = &spec.ExpFlag{
	Name:     "ssh-port",
	Desc:     "Use this flag when the channel is ssh",
	NoArgs:   false,
	Required: false,
}
View Source
var SSHUserFlag = &spec.ExpFlag{
	Name:     "ssh-user",
	Desc:     "Use this flag when the channel is ssh",
	NoArgs:   false,
	Required: false,
}

Functions

func CheckFilepathExists

func CheckFilepathExists(ctx context.Context, cl spec.Channel, filepath string) bool

func ConvertOutputToResponse

func ConvertOutputToResponse(ctx context.Context, output string, err error, defaultResponse *spec.Response) *spec.Response

func Destroy

func Destroy(ctx context.Context, c spec.Channel, action string) *spec.Response

stop hang process

func Hierarchy

func Hierarchy(root string) func() ([]cgroups.Subsystem, error)

func NewSSHExecutor

func NewSSHExecutor() spec.Executor

func PidPath

func PidPath(pid int) cgroups.Path

Types

type SSHClient

type SSHClient struct {
	Host     string
	Username string
	Key      string

	Password string
	Port     int
	// contains filtered or unexported fields
}

func (SSHClient) RunCommand

func (c SSHClient) RunCommand(command string) ([]byte, error)

func (SSHClient) RunCommandWithResponse

func (c SSHClient) RunCommandWithResponse(ctx context.Context, cmd string) (*spec.Response, bool)

type SSHExecutor

type SSHExecutor struct {
	spec.Executor
}

func (*SSHExecutor) Exec

func (e *SSHExecutor) Exec(uid string, ctx context.Context, expModel *spec.ExpModel) *spec.Response

func (*SSHExecutor) Name

func (*SSHExecutor) Name() string

func (*SSHExecutor) SetChannel

func (e *SSHExecutor) SetChannel(channel spec.Channel)

Directories

Path Synopsis
tc

Jump to

Keyboard shortcuts

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