Documentation
¶
Overview ¶
Copyright © 2020 The Platform9 Systems Inc.
Index ¶
- Variables
- func CheckRemote(nc objects.NodeConfig) bool
- func ConfidentialInfoRemover(cmd string) string
- func ExitCodeChecker(err error) (string, int)
- type Executor
- type LocalExecutor
- type MockExecutor
- type RemoteExecutor
- func (r *RemoteExecutor) Run(name string, args ...string) error
- func (r *RemoteExecutor) RunCommandWait(command string) string
- func (r *RemoteExecutor) RunWithProgressStages(name string, args ...string) (string, error)
- func (r *RemoteExecutor) RunWithStdout(name string, args ...string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var StdErrSudoPassword string
To fetch the stderr after executing command
Functions ¶
func CheckRemote ¶
func CheckRemote(nc objects.NodeConfig) bool
func ConfidentialInfoRemover ¶
Avoid confidential information from getting logged
func ExitCodeChecker ¶
Types ¶
type Executor ¶
type Executor interface { Run(name string, args ...string) error RunWithStdout(name string, args ...string) (string, error) RunCommandWait(command string) string RunWithProgressStages(name string, args ...string) (string, error) }
Executor interface abstracts us from local or remote execution
func GetExecutor ¶
func GetExecutor(proxyURL string, nc objects.NodeConfig) (Executor, error)
type LocalExecutor ¶
type LocalExecutor struct {
ProxyUrl string
}
LocalExecutor as the name implies executes commands locally
func (LocalExecutor) Run ¶
func (c LocalExecutor) Run(name string, args ...string) error
Run runs a command locally returning just success or failure
func (LocalExecutor) RunCommandWait ¶
func (c LocalExecutor) RunCommandWait(command string) string
func (LocalExecutor) RunWithProgressStages ¶
func (c LocalExecutor) RunWithProgressStages(name string, args ...string) (string, error)
RunWithProgressBar runs a command locally displaying the progress status along with stdout and err
func (LocalExecutor) RunWithStdout ¶
func (c LocalExecutor) RunWithStdout(name string, args ...string) (string, error)
RunWithStdout runs a command locally returning stdout and err
type MockExecutor ¶
type MockExecutor struct { MockRun func(name string, args ...string) error MockRunWithStdout func(name string, args ...string) (string, error) MockRunCommandWait func(name string) string MockRunWithProgressStages func(name string, args ...string) (string, error) }
func (*MockExecutor) RunCommandWait ¶
func (m *MockExecutor) RunCommandWait(name string) string
func (*MockExecutor) RunWithProgressStages ¶
func (m *MockExecutor) RunWithProgressStages(name string, args ...string) (string, error)
func (*MockExecutor) RunWithStdout ¶
func (m *MockExecutor) RunWithStdout(name string, args ...string) (string, error)
type RemoteExecutor ¶
RemoteExecutor as the name implies runs commands usign SSH on remote host
func (*RemoteExecutor) Run ¶
func (r *RemoteExecutor) Run(name string, args ...string) error
Run runs a command locally returning just success or failure
func (*RemoteExecutor) RunCommandWait ¶
func (r *RemoteExecutor) RunCommandWait(command string) string
func (*RemoteExecutor) RunWithProgressStages ¶
func (r *RemoteExecutor) RunWithProgressStages(name string, args ...string) (string, error)
RunWithProgressBar runs a command remote host displaying the progress status along with stdout
func (*RemoteExecutor) RunWithStdout ¶
func (r *RemoteExecutor) RunWithStdout(name string, args ...string) (string, error)
RunWithStdout runs a command locally returning stdout and err