Documentation ¶
Index ¶
- func SudoPrefix(cmd string) string
- type 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) GetInternalIPv4Address() string
- func (b *BaseHost) GetInternalIPv6Address() 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
- 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
- type Connection
- type Connector
- type Dialer
- type Host
- type ModuleRuntime
- type Runner
- 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
- type Tee
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SudoPrefix ¶
Types ¶
type BaseHost ¶
type BaseHost struct { Name string `yaml:"name,omitempty" json:"name,omitempty"` Address string `yaml:"address,omitempty" json:"address,omitempty"` InternalAddress string `yaml:"internalAddress,omitempty" json:"internalAddress,omitempty"` Port int `yaml:"port,omitempty" json:"port,omitempty"` User string `yaml:"user,omitempty" json:"user,omitempty"` Password string `yaml:"password,omitempty" json:"password,omitempty"` PrivateKey string `yaml:"privateKey,omitempty" json:"privateKey,omitempty"` PrivateKeyPath string `yaml:"privateKeyPath,omitempty" json:"privateKeyPath,omitempty"` Arch string `yaml:"arch,omitempty" json:"arch,omitempty"` Timeout int64 `yaml:"timeout,omitempty" json:"timeout,omitempty"` Roles []string `json:"-"` RoleTable map[string]bool `json:"-"` Cache *cache.Cache `json:"-"` }
func (*BaseHost) GetAddress ¶
func (*BaseHost) GetInternalAddress ¶
func (*BaseHost) GetInternalIPv4Address ¶ added in v3.1.0
func (*BaseHost) GetInternalIPv6Address ¶ added in v3.1.0
func (*BaseHost) GetPassword ¶
func (*BaseHost) GetPrivateKey ¶
func (*BaseHost) GetPrivateKeyPath ¶
func (*BaseHost) GetTimeout ¶
func (*BaseHost) SetAddress ¶
func (*BaseHost) SetInternalAddress ¶
func (*BaseHost) SetPassword ¶
func (*BaseHost) SetPrivateKey ¶
func (*BaseHost) SetPrivateKeyPath ¶
func (*BaseHost) SetTimeout ¶
type BaseRuntime ¶
type BaseRuntime struct { ObjName string // contains filtered or unexported fields }
func NewBaseRuntime ¶
func NewBaseRuntime(name string, connector Connector, verbose bool, ignoreErr bool) BaseRuntime
func (*BaseRuntime) AppendHost ¶
func (b *BaseRuntime) AppendHost(host Host)
func (*BaseRuntime) AppendRoleMap ¶
func (b *BaseRuntime) AppendRoleMap(host Host)
func (*BaseRuntime) Copy ¶
func (b *BaseRuntime) Copy() Runtime
func (*BaseRuntime) DeleteHost ¶
func (b *BaseRuntime) DeleteHost(host Host)
func (*BaseRuntime) GenerateRoleMap ¶
func (b *BaseRuntime) GenerateRoleMap()
func (*BaseRuntime) GenerateWorkDir ¶
func (b *BaseRuntime) GenerateWorkDir() error
func (*BaseRuntime) GetAllHosts ¶
func (b *BaseRuntime) GetAllHosts() []Host
func (*BaseRuntime) GetConnector ¶
func (b *BaseRuntime) GetConnector() Connector
func (*BaseRuntime) GetHostWorkDir ¶
func (b *BaseRuntime) GetHostWorkDir() string
func (*BaseRuntime) GetHostsByRole ¶
func (b *BaseRuntime) GetHostsByRole(role string) []Host
func (*BaseRuntime) GetIgnoreErr ¶
func (b *BaseRuntime) GetIgnoreErr() bool
func (*BaseRuntime) GetObjName ¶
func (b *BaseRuntime) GetObjName() string
func (*BaseRuntime) GetRunner ¶
func (b *BaseRuntime) GetRunner() *Runner
func (*BaseRuntime) GetWorkDir ¶
func (b *BaseRuntime) GetWorkDir() string
func (*BaseRuntime) HostIsDeprecated ¶
func (b *BaseRuntime) HostIsDeprecated(host Host) bool
func (*BaseRuntime) InitLogger ¶
func (b *BaseRuntime) InitLogger() error
func (*BaseRuntime) RemoteHost ¶
func (b *BaseRuntime) RemoteHost() Host
func (*BaseRuntime) RoleMapDelete ¶
func (b *BaseRuntime) RoleMapDelete(host Host)
func (*BaseRuntime) SetAllHosts ¶
func (b *BaseRuntime) SetAllHosts(hosts []Host)
func (*BaseRuntime) SetConnector ¶
func (b *BaseRuntime) SetConnector(c Connector)
func (*BaseRuntime) SetObjName ¶
func (b *BaseRuntime) SetObjName(name string)
func (*BaseRuntime) SetRunner ¶
func (b *BaseRuntime) SetRunner(r *Runner)
type Connection ¶
type Connection interface { Exec(cmd string, host Host) (stdout string, code int, err error) PExec(cmd string, stdin io.Reader, stdout io.Writer, stderr io.Writer, host Host) (code int, err error) Fetch(local, remote string, host Host) error Scp(local, remote string, host Host) error RemoteFileExist(remote string, host Host) bool RemoteDirExist(remote string, host Host) (bool, error) MkDirAll(path string, mode string, host Host) error Chmod(path string, mode os.FileMode) error Close() }
func NewConnection ¶
func NewConnection(cfg Cfg) (Connection, error)
type Connector ¶
type Connector interface { Connect(host Host) (Connection, error) Close(host Host) }
type Host ¶
type Host interface { GetName() string SetName(name string) GetAddress() string SetAddress(str string) GetInternalAddress() string GetInternalIPv4Address() string GetInternalIPv6Address() string SetInternalAddress(str string) GetPort() int SetPort(port int) GetUser() string SetUser(u string) GetPassword() string SetPassword(password string) GetPrivateKey() string SetPrivateKey(privateKey string) GetPrivateKeyPath() string SetPrivateKeyPath(path string) GetArch() string SetArch(arch string) GetTimeout() int64 SetTimeout(timeout int64) GetRoles() []string SetRoles(roles []string) IsRole(role string) bool GetCache() *cache.Cache SetCache(c *cache.Cache) }
type ModuleRuntime ¶
type ModuleRuntime interface { GetObjName() string SetObjName(name string) GenerateWorkDir() error GetHostWorkDir() string GetWorkDir() string GetIgnoreErr() bool GetAllHosts() []Host SetAllHosts([]Host) GetHostsByRole(role string) []Host DeleteHost(host Host) HostIsDeprecated(host Host) bool InitLogger() error }
type Runner ¶
type Runner struct { Conn Connection Debug bool Host Host Index int }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.