Documentation
¶
Index ¶
- Constants
- Variables
- func LocalTarCmdArgs(path, exclude string) []string
- func NewTarStreamReader(cwd, path, exclude string) (io.Reader, error)
- func RemoteTarCommand(dir string) string
- func ResolveLocalPath(cwd, path, env string) (string, error)
- type Client
- type Command
- type Commands
- type EnvList
- type EnvVar
- type ErrConnect
- type ErrMustUpdate
- type ErrTask
- type ErrUnsupportedSupfileVersion
- type LocalhostClient
- func (c *LocalhostClient) Close() error
- func (c *LocalhostClient) Connect(_ string) error
- func (c *LocalhostClient) Prefix() (string, int)
- func (c *LocalhostClient) Run(task *Task) error
- func (c *LocalhostClient) Signal(sig os.Signal) error
- func (c *LocalhostClient) Stderr() io.Reader
- func (c *LocalhostClient) Stdin() io.WriteCloser
- func (c *LocalhostClient) Stdout() io.Reader
- func (c *LocalhostClient) Wait() error
- func (c *LocalhostClient) Write(p []byte) (n int, err error)
- func (c *LocalhostClient) WriteClose() error
- type Network
- type Networks
- type SSHClient
- func (c *SSHClient) Close() error
- func (c *SSHClient) Connect(host string) error
- func (c *SSHClient) ConnectWith(host string, dialer SSHDialFunc) error
- func (sc *SSHClient) DialThrough(net, addr string, config *ssh.ClientConfig) (*ssh.Client, error)
- func (c *SSHClient) Prefix() (string, int)
- func (c *SSHClient) Run(task *Task) error
- func (c *SSHClient) Signal(sig os.Signal) error
- func (c *SSHClient) Stderr() io.Reader
- func (c *SSHClient) Stdin() io.WriteCloser
- func (c *SSHClient) Stdout() io.Reader
- func (c *SSHClient) Wait() error
- func (c *SSHClient) Write(p []byte) (n int, err error)
- func (c *SSHClient) WriteClose() error
- type SSHDialFunc
- type Stackup
- type Supfile
- type Targets
- type Task
- type Upload
Constants ¶
const VERSION = "0.6.0"
Variables ¶
var ( Colors = []string{ "\033[32m", "\033[33m", "\033[36m", "\033[35m", "\033[31m", "\033[34m", } ResetColor = "\033[0m" )
Functions ¶
func LocalTarCmdArgs ¶
func NewTarStreamReader ¶
NewTarStreamReader создает устройство чтения потока tar из локального пути TODO: Вместо этого использовать "archive/tar".
func RemoteTarCommand ¶
RemoteTarCommand возвращает команду, которая должна быть запущена на удаленном SSH-хосте TODO: Проверка относительной директории.
func ResolveLocalPath ¶
Types ¶
type Command ¶
type Command struct {
Name string `yaml:"-"` // Название команды
Desc string `yaml:"desc"` // Описание команды
Local string `yaml:"local"` // Для локального запуска
Run string `yaml:"run"` // Для удаленного запуска
Script string `yaml:"script"` // Загрузить команду из скрипта и запустить ее удаленно
Upload []Upload `yaml:"upload"` // Структура Upload
Stdin bool `yaml:"stdin"` // да/нет - присоединить STDOUT локального хоста к STDIN удаленных команд
Once bool `yaml:"once"` // да/нет - команда должна быть запущена один раз (только на одном хосте).
Serial int `yaml:"serial"` // Максимальное количество клиентов, обрабатывающих задачу параллельно
RunOnce bool `yaml:"run_once"` // да/нет - команда должна быть выполнена только один раз
}
Command представляет команду/команды для удаленного выполнения
type Commands ¶
type Commands struct {
Names []string
// contains filtered or unexported fields
}
Список команд (определяемых пользователем)
func (*Commands) UnmarshalYAML ¶
type EnvList ¶
type EnvList []*EnvVar
EnvList - это список переменных окружения, который отображается на карту YAML, но сохраняет порядок, позволяя поздним переменным ссылаться на ранние.
func (*EnvList) ResolveValues ¶
func (*EnvList) UnmarshalYAML ¶
type EnvVar ¶
Переменная окружения
type ErrConnect ¶
func (ErrConnect) Error ¶
func (e ErrConnect) Error() string
type ErrMustUpdate ¶
type ErrMustUpdate struct {
Msg string
}
func (ErrMustUpdate) Error ¶
func (e ErrMustUpdate) Error() string
type ErrUnsupportedSupfileVersion ¶
type ErrUnsupportedSupfileVersion struct {
Msg string
}
func (ErrUnsupportedSupfileVersion) Error ¶
func (e ErrUnsupportedSupfileVersion) Error() string
type LocalhostClient ¶
type LocalhostClient struct {
// contains filtered or unexported fields
}
Основная структура клиента
func (*LocalhostClient) Close ¶
func (c *LocalhostClient) Close() error
func (*LocalhostClient) Connect ¶
func (c *LocalhostClient) Connect(_ string) error
func (*LocalhostClient) Prefix ¶
func (c *LocalhostClient) Prefix() (string, int)
func (*LocalhostClient) Run ¶
func (c *LocalhostClient) Run(task *Task) error
func (*LocalhostClient) Stderr ¶
func (c *LocalhostClient) Stderr() io.Reader
func (*LocalhostClient) Stdin ¶
func (c *LocalhostClient) Stdin() io.WriteCloser
func (*LocalhostClient) Stdout ¶
func (c *LocalhostClient) Stdout() io.Reader
func (*LocalhostClient) Wait ¶
func (c *LocalhostClient) Wait() error
func (*LocalhostClient) WriteClose ¶
func (c *LocalhostClient) WriteClose() error
type Network ¶
type Network struct {
Env EnvList `yaml:"env"`
Inventory string `yaml:"inventory"`
Hosts []string `yaml:"hosts"`
Bastion string `yaml:"bastion"` // Jump host for the environment
User string // `yaml:"user"`
IdentityFile string // `yaml:"identity_file"`
}
Сеть - это группа хостов с дополнительными пользовательскими параметрами переменных (env)
func (Network) ParseInventory ¶
Запустить команду инвентаризации (если она была предоставлена), и добавить выходные строки команды к списку хостов, заданному вручную
type Networks ¶
type Networks struct {
Names []string
// contains filtered or unexported fields
}
Сети - это список сетей, определенных пользователем
func (*Networks) UnmarshalYAML ¶
type SSHClient ¶
type SSHClient struct {
// contains filtered or unexported fields
}
Клиент - это обертка над ssh соединением/сессией
func (*SSHClient) Connect ¶
Connect creates SSH connection to a specified host. It expects the host of the form "[ssh://]host[:port]".
func (*SSHClient) ConnectWith ¶
func (c *SSHClient) ConnectWith(host string, dialer SSHDialFunc) error
Создает ssh соединение с указанным хостом с использованием dialer для авторизации по ключу
func (*SSHClient) DialThrough ¶
Создает новое ssh соединение с сервером через уже существующие ssh подключение
func (*SSHClient) Stdin ¶
func (c *SSHClient) Stdin() io.WriteCloser
func (*SSHClient) Wait ¶
Дожидается окончания выполнения удаленной команды и выходит из системы (закрывает ssh сессию)
func (*SSHClient) WriteClose ¶
type SSHDialFunc ¶
SSHDialFunc can dial an ssh server and return a client
type Supfile ¶
type Supfile struct {
Networks Networks `yaml:"networks"`
Commands Commands `yaml:"commands"`
Targets Targets `yaml:"targets"`
Env EnvList `yaml:"env"`
Version string `yaml:"version"`
}
Структура Supfile в формате YAML
func NewSupfile ¶
Парсим конфигурационный файл и возвращаем Supfile или ошибку
type Targets ¶
type Targets struct {
Names []string
// contains filtered or unexported fields
}
Список целей (определяемых пользователем)



