Documentation
¶
Index ¶
- Constants
- Variables
- type AffixMappig
- type ArgParserFacade
- type ClientFacade
- type Command
- type Commands
- type CopyOrder
- type EnvList
- type EnvVar
- type ErrMustUpdate
- type ErrTask
- type ErrUnsupportedSupfileVersion
- type FetchOrder
- type FlagStringSlice
- type HelpDisplayer
- type HostNamespace
- type InitState
- type InitialArgs
- type Network
- type NetworkHost
- type Networks
- type Play
- type PlayBook
- type Supfile
- type Targets
- type Task
- type Upload
Constants ¶
const CsupDoSudoEnv = "SUP_SUDO"
const CsupPasswdEnv = "SUP_PASSWORD"
const PassSeparator = " | "
const SPEW_DEPTH = 1
const TASK_TAIL = "_ssup_exec_script.sh"
const TubeNameSeparator = " << "
const VARS_TAIL = "_ssup_vars.env"
const VERSION = "0.5"
Variables ¶
var ( Colors = []string{ "\033[32m", "\033[33m", "\033[36m", "\033[35m", "\033[31m", "\033[34m", } ResetColor = "\033[0m" )
var ( ErrUsage = errors.New("Usage: sup [OPTIONS] NETWORK COMMAND [...]\n sup [ --help | -v | --version ]") ErrUnknownNetwork = errors.New("Unknown network\nif Supfile has networks: section defined\nyou MUST give network name as a first argument") ErrNetworkNoHosts = errors.New("No hosts defined for a given network") ErrCmd = errors.New("Unknown command/target") ErrTargetNoCommands = errors.New("No commands defined for a given target") ErrConfigFile = errors.New("Unknown ssh_config file") )
Functions ¶
This section is empty.
Types ¶
type AffixMappig ¶
type ArgParserFacade ¶
type ArgParserFacade interface {
Parse(conf *Supfile, initialArgs *InitialArgs, helpMenu HelpDisplayer) (*PlayBook, error)
}
type ClientFacade ¶
type ClientFacade interface { Connect(host NetworkHost) error SetRcloneCfg(config string) Run(task *Task) error Wait() error Close() error Prefix() (string, int) Write(p []byte) (n int, err error) WriteClose() error Stdin() io.WriteCloser Stderr() io.Reader Stdout() io.Reader Signal(os.Signal) error Upload(src string, dest string, cfg string) error Download(src string, dest string, silent bool) error GenerateOnRemote(data []byte) error GetHost() string GetTube() string SetTube(name string) }
type Command ¶
type Command struct { Name string `yaml:"-"` // Command name. Desc string `yaml:"desc"` // Command description. Local string `yaml:"local"` // Command(s) to be run locally. Run string `yaml:"run"` // Command(s) to be run remotelly. Script string `yaml:"script"` // Load command(s) from script and run it remotelly. Upload []*Upload `yaml:"upload"` // See Upload struct. Copy *CopyOrder `yaml:"copy"` // See Upload struct. Stdin bool `yaml:"stdin"` // Attach localhost STDOUT to remote commands' STDIN? Once bool `yaml:"once"` // The command should be run "once" (on one host only). Serial int `yaml:"serial"` // Max number of clients processing a task in parallel. Fetch *FetchOrder `yaml:"fetch" ` // See Fetch struct. Sudo bool `yaml:"sudo" ` // Run command(s) as root? SudoPass string `yaml:"sudo_pass"` Env EnvList `yaml:"env"` // API backward compatibility. Will be deprecated in v1.0. RunOnce bool `yaml:"run_once"` // The command should be run once only. }
Command represents command(s) to be run remotely.
type EnvList ¶
type EnvList struct {
// contains filtered or unexported fields
}
EnvList is a list of environment variables that maps to a YAML map, but maintains order, enabling late variables to reference early variables.
func (*EnvList) UnmarshalYAML ¶
type EnvVar ¶
EnvVar represents an environment variable
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 FetchOrder ¶
type FlagStringSlice ¶
type FlagStringSlice []string
func (*FlagStringSlice) Set ¶
func (f *FlagStringSlice) Set(value string) error
func (*FlagStringSlice) String ¶
func (f *FlagStringSlice) String() string
type HelpDisplayer ¶
type HelpDisplayer struct { ShowNetwork bool ShowCmd bool // ShowTarget bool ShowMakeMode bool Color bool }
func (*HelpDisplayer) Show ¶
func (h *HelpDisplayer) Show(conf *Supfile)
func (*HelpDisplayer) ShowAll ¶
func (h *HelpDisplayer) ShowAll(conf *Supfile)
type HostNamespace ¶
HostNamespace stores env vars from the host it has methods to get and set env variables
func (*HostNamespace) Get ¶
func (h *HostNamespace) Get(key string) string
Get returns the value of the env var
func (HostNamespace) Set ¶
func (h HostNamespace) Set(key, value string)
Set sets the value of the env var
func (*HostNamespace) Unset ¶
func (h *HostNamespace) Unset(key string)
Unset unsets the value of the env var
type InitState ¶
type InitState struct { Conf *Supfile InitialArgs *InitialArgs }
type InitialArgs ¶
type Network ¶
type Network struct { Env EnvList `yaml:"env"` Inventory string `yaml:"inventory"` Hosts []NetworkHost `yaml:"hosts"` Bastion string `yaml:"bastion"` // Jump host for the environment // Should these live on Hosts too? We'd have to change []string to struct, even in Supfile. User string `yaml:"user"` Password string `yaml:"pass" ` IdentityFile string `yaml:"id_file"` Name string }
Network is group of hosts with extra custom env vars.
func (Network) ParseInventory ¶
func (n Network) ParseInventory() ([]NetworkHost, error)
ParseInventory runs the inventory command, if provided, and appends the command's output lines to the manually defined list of hosts.
func (*Network) UnmarshalYAML ¶
type NetworkHost ¶
type NetworkHost struct { Host string `yaml:"host"` User string `yaml:"user"` Password string `yaml:"pass"` Tube string `yaml:"tube"` Env EnvList `yaml:"env"` Sudo bool `yaml:"sudo" default:"false"` }
func (*NetworkHost) UnmarshalYAML ¶
func (n *NetworkHost) UnmarshalYAML(unmarshal func(interface{}) error) error
type Networks ¶
Networks is a list of user-defined networks
func (*Networks) Set ¶
this is just to set localhost so we dont process slice of values as we should be...
func (*Networks) UnmarshalYAML ¶
type PlayBook ¶
type PlayBook struct {
// contains filtered or unexported fields
}
ParsedData encapsulates parsed inital arguments
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"` Desc string `yaml:"desc"` }
Supfile represents the Stack Up configuration YAML file.
type Targets ¶
type Targets struct { Names []string // contains filtered or unexported fields }
Targets is a list of user-defined targets by default affixed are mapped by command name
func (*Targets) GetAffixByCommandName ¶
func (t *Targets) GetAffixByCommandName(name string) (AffixMappig, bool)