Documentation
¶
Index ¶
- func ParallelScp(item ScpItem) chan error
- func RemoteRun(b []byte, logger *logrus.Logger, cmd string) error
- type ExecutorExternal
- type ExecutorInternal
- type InternelServersSlice
- type Item
- type ScpItem
- type ServerExternal
- type ServerInternal
- type ServerListExternal
- type ServerListInternal
- type ShellResult
- type ShellResultSlice
- type WindowsErr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExecutorExternal ¶
type ExecutorExternal struct {
Servers []ServerExternal `yaml:"server"`
Excludes []string `yaml:"excludes"`
Script string `yaml:"script"`
logrus.Logger
}
ExecutorExternal 执行器序列化对象
type ExecutorInternal ¶
type ExecutorInternal struct {
Servers []ServerInternal
Script string
Logger *logrus.Logger
OutPutRealTime bool
}
ExecutorInternal 执行器内部对象
func ParseExecutor ¶
func ParseExecutor(b []byte, logger *logrus.Logger) (ExecutorInternal, error)
ParseExecutor 执行器反序列化
func (ExecutorInternal) ParallelRun ¶
func (executor ExecutorInternal) ParallelRun() chan ShellResult
ParallelRun 并发执行
type InternelServersSlice ¶
type InternelServersSlice []ServerInternal
InternelServersSlice 带有排序的server列表
func (InternelServersSlice) Len ¶
func (servers InternelServersSlice) Len() int
func (InternelServersSlice) Less ¶
func (servers InternelServersSlice) Less(i, j int) bool
func (InternelServersSlice) Swap ¶
func (servers InternelServersSlice) Swap(i, j int)
type Item ¶
type Item struct {
Server ServerInternal
Cmd string
Logger *logrus.Logger
OutputRealTime bool
}
Item 执行run指令的对象
type ScpItem ¶
type ScpItem struct {
Servers []ServerInternal
SrcPath string
DstPath string
Mode os.FileMode
Logger *logrus.Logger
ShowProcessBar bool
}
ScpItem 定义跨主机拷贝属性
type ServerExternal ¶
type ServerExternal struct {
Host string `yaml:"host"`
Port string `yaml:"port"`
Username string `yaml:"username"`
Password string `yaml:"password"`
PrivateKeyPath string `yaml:"privateKeyPath"`
}
ServerExternal server序列化对象
type ServerInternal ¶
type ServerInternal struct {
Host string
Port string
Username string
Password string
PrivateKeyPath string
}
ServerInternal server内部对象
func ParseServerList ¶
func ParseServerList(b []byte, logger *logrus.Logger) ([]ServerInternal, error)
ParseServerList ServerList反序列化
func (ServerInternal) ReturnRunResult ¶
func (server ServerInternal) ReturnRunResult(cmd string) ShellResult
ReturnRunResult 获取执行结果
type ServerListExternal ¶
type ServerListExternal struct {
Servers []ServerExternal `yaml:"server"`
Excludes []string `yaml:"excludes"`
}
ServerListExternal server列表序列化对象
type ServerListInternal ¶
type ServerListInternal struct {
Servers []ServerInternal
Excludes []string
}
ServerListInternal server列表内部对象
type ShellResult ¶
type ShellResult struct {
Host string `table:"主机地址"`
Cmd string `table:"执行语句"`
Code int `table:"退出码"`
Status string `table:"执行状态"`
StdOut string `table:"执行结果"`
Output string `table:"标准输出"`
StdErrMsg string
Err error
}
ShellResult shell执行结果
type ShellResultSlice ¶
type ShellResultSlice []ShellResult
ShellResultSlice shell执行结果切片
func (ShellResultSlice) Len ¶
func (re ShellResultSlice) Len() int
func (ShellResultSlice) Less ¶
func (re ShellResultSlice) Less(i, j int) bool
func (ShellResultSlice) Swap ¶
func (re ShellResultSlice) Swap(i, j int)
type WindowsErr ¶
type WindowsErr struct {
Errors string
}
Click to show internal directories.
Click to hide internal directories.