Versions in this module Expand all Collapse all v2 v2.3.2 Dec 21, 2022 Changes in this version + func SudoPrefix(cmd string) string + type BaseHost struct + Address string + Arch string + Cache *cache.Cache + InternalAddress string + Name string + Password string + Port int + PrivateKey string + PrivateKeyPath string + RoleTable map[string]bool + Roles []string + Timeout int64 + User string + func NewHost() *BaseHost + func (b *BaseHost) GetAddress() string + func (b *BaseHost) GetArch() string + func (b *BaseHost) GetCache() *cache.Cache + func (b *BaseHost) GetInternalAddress() string + func (b *BaseHost) GetName() string + func (b *BaseHost) GetPassword() string + func (b *BaseHost) GetPort() int + func (b *BaseHost) GetPrivateKey() string + func (b *BaseHost) GetPrivateKeyPath() string + func (b *BaseHost) GetRoles() []string + func (b *BaseHost) GetTimeout() int64 + func (b *BaseHost) GetUser() string + func (b *BaseHost) IsRole(role string) bool + func (b *BaseHost) SetAddress(str string) + func (b *BaseHost) SetArch(arch string) + func (b *BaseHost) SetCache(c *cache.Cache) + func (b *BaseHost) SetInternalAddress(str string) + func (b *BaseHost) SetName(name string) + func (b *BaseHost) SetPassword(password string) + func (b *BaseHost) SetPort(port int) + func (b *BaseHost) SetPrivateKey(privateKey string) + func (b *BaseHost) SetPrivateKeyPath(path string) + func (b *BaseHost) SetRole(role string) + func (b *BaseHost) SetRoles(roles []string) + func (b *BaseHost) SetTimeout(timeout int64) + func (b *BaseHost) SetUser(u string) + type BaseRuntime struct + ObjName string + func NewBaseRuntime(name string, connector Connector, verbose bool, ignoreErr bool) BaseRuntime + func (b *BaseRuntime) AppendHost(host Host) + func (b *BaseRuntime) AppendRoleMap(host Host) + func (b *BaseRuntime) Copy() Runtime + func (b *BaseRuntime) DeleteHost(host Host) + func (b *BaseRuntime) GenerateRoleMap() + func (b *BaseRuntime) GenerateWorkDir() error + func (b *BaseRuntime) GetAllHosts() []Host + func (b *BaseRuntime) GetConnector() Connector + func (b *BaseRuntime) GetHostWorkDir() string + func (b *BaseRuntime) GetHostsByRole(role string) []Host + func (b *BaseRuntime) GetIgnoreErr() bool + func (b *BaseRuntime) GetObjName() string + func (b *BaseRuntime) GetRunner() *Runner + func (b *BaseRuntime) GetWorkDir() string + func (b *BaseRuntime) HostIsDeprecated(host Host) bool + func (b *BaseRuntime) InitLogger() error + func (b *BaseRuntime) RemoteHost() Host + func (b *BaseRuntime) RoleMapDelete(host Host) + func (b *BaseRuntime) SetAllHosts(hosts []Host) + func (b *BaseRuntime) SetConnector(c Connector) + func (b *BaseRuntime) SetObjName(name string) + func (b *BaseRuntime) SetRunner(r *Runner) + type Cfg struct + Address string + AgentSocket string + Bastion string + BastionPort int + BastionUser string + KeyFile string + Password string + Port int + PrivateKey string + Timeout time.Duration + Username string + type Connection interface + Chmod func(path string, mode os.FileMode) error + Close func() + Exec func(cmd string, host Host) (stdout string, code int, err error) + Fetch func(local, remote string, host Host) error + MkDirAll func(path string, mode string, host Host) error + PExec func(cmd string, stdin io.Reader, stdout io.Writer, stderr io.Writer, host Host) (code int, err error) + RemoteDirExist func(remote string, host Host) (bool, error) + RemoteFileExist func(remote string, host Host) bool + Scp func(local, remote string, host Host) error + func NewConnection(cfg Cfg) (Connection, error) + type Connector interface + Close func(host Host) + Connect func(host Host) (Connection, error) + type Dialer struct + func NewDialer() *Dialer + func (d *Dialer) Close(host Host) + func (d *Dialer) Connect(host Host) (Connection, error) + type Host interface + GetAddress func() string + GetArch func() string + GetCache func() *cache.Cache + GetInternalAddress func() string + GetName func() string + GetPassword func() string + GetPort func() int + GetPrivateKey func() string + GetPrivateKeyPath func() string + GetRoles func() []string + GetTimeout func() int64 + GetUser func() string + IsRole func(role string) bool + SetAddress func(str string) + SetArch func(arch string) + SetCache func(c *cache.Cache) + SetInternalAddress func(str string) + SetName func(name string) + SetPassword func(password string) + SetPort func(port int) + SetPrivateKey func(privateKey string) + SetPrivateKeyPath func(path string) + SetRoles func(roles []string) + SetTimeout func(timeout int64) + SetUser func(u string) + type ModuleRuntime interface + DeleteHost func(host Host) + GenerateWorkDir func() error + GetAllHosts func() []Host + GetHostWorkDir func() string + GetHostsByRole func(role string) []Host + GetIgnoreErr func() bool + GetObjName func() string + GetWorkDir func() string + HostIsDeprecated func(host Host) bool + InitLogger func() error + SetAllHosts func([]Host) + SetObjName func(name string) + type Runner struct + Conn Connection + Debug bool + Host Host + Index int + func (r *Runner) Chmod(path string, mode os.FileMode) error + func (r *Runner) Cmd(cmd string, printOutput bool) (string, error) + func (r *Runner) DirExist(remote string) (bool, error) + func (r *Runner) Exec(cmd string, printOutput bool) (string, int, error) + func (r *Runner) Fetch(local, remote string) error + func (r *Runner) FileExist(remote string) (bool, error) + func (r *Runner) FileMd5(path string) (string, error) + func (r *Runner) MkDir(path string) error + func (r *Runner) Scp(local, remote string) error + func (r *Runner) SudoCmd(cmd string, printOutput bool) (string, error) + func (r *Runner) SudoExec(cmd string, printOutput bool) (string, int, error) + func (r *Runner) SudoScp(local, remote string) error + type Runtime interface + Copy func() Runtime + GetConnector func() Connector + GetRunner func() *Runner + RemoteHost func() Host + SetConnector func(c Connector) + SetRunner func(r *Runner) + type Tee struct + func NewTee(wc io.WriteCloser) *Tee + func (t *Tee) Close() error + func (t *Tee) String() string + func (t *Tee) Write(p []byte) (int, error)