Documentation
¶
Index ¶
- Constants
- Variables
- func IsShell(cmd string) bool
- func ResolveShell(value string) (string, error)
- type ArgParserFacade
- type ClientFacade
- type Command
- type ConnectOrder
- type DownloadOrder
- type EnvList
- type EnvVar
- type ErrMustUpdate
- type ErrTask
- type ErrUnsupportedSupfileVersion
- type FlagStringSlice
- type HelpDisplayer
- type HostNamespace
- type InitState
- type InitialArgs
- type Inventory
- func (i *Inventory) CheckBashCommand() []string
- func (i *Inventory) CheckHomeCommand() []string
- func (i *Inventory) CheckOsTypeCommand() []string
- func (i *Inventory) CheckShCommand() []string
- func (i *Inventory) CheckUserCommand() []string
- func (i *Inventory) DetectArchCommand() []string
- func (i *Inventory) GetHomeUnixCommand() []string
- func (i *Inventory) GetHomeWinCommand() []string
- func (i *Inventory) GetShell() string
- type Network
- type NetworkHost
- type Play
- type PlayBook
- type RunOrder
- type ShellCheckFacade
- type Supfile
- type Task
- type UploadOrder
Constants ¶
View Source
const ( SSUP_WORK_FOLDER = consts.SSUP_WORK_FOLDER MAIN_SCRIPT = consts.MAIN_SCRIPT VARS_FILE = consts.VARS_FILE HASHED_PASS = consts.HASHED_PASS INJECTED_COMMANDS_FILE = consts.INJECTED_COMMANDS_FILE VERSION = consts.VERSION PassSeparator = consts.PassSeparator TubeNameSeparator = consts.TubeNameSeparator CsupPasswdEnv = consts.CsupPasswdEnv CsupDoSudoEnv = consts.CsupDoSudoEnv )
Re-export constants from the consts package to maintain compatibility
Variables ¶
View Source
var ( Colors = []string{ "\033[32m", "\033[33m", "\033[36m", "\033[35m", "\033[31m", "\033[34m", } ResetColor = "\033[0m" )
View Source
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") )
View Source
var ExampleSupfile = `` /* 1158-byte string literal not displayed */
ExampleSupfile is an example supfile.
Functions ¶
func ResolveShell ¶
Types ¶
type ArgParserFacade ¶
type ArgParserFacade interface {
Parse(conf *supfile.Supfile, initialArgs *InitialArgs, helpMenu HelpDisplayer) (*PlayBook, error)
}
type ClientFacade ¶
type ClientFacade interface {
GetConnection() *ssh.Client
GetSSHConfig() *ssh.ClientConfig
Connect(host supfile.NetworkHost) error
SetConnection(*ssh.Client)
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) error
Download(src string, dest string, silent bool, flat bool) error
GenerateOnRemote(data []byte, dest string) error
GetHost() string
GetTube() string
SetTube(name string)
GetInventory() *Inventory
GetShell() string
String() string
CopyDistFolders() error
}
type ConnectOrder ¶
type ConnectOrder struct {
Host string // will contain ip:port
ClientConfig *ssh.ClientConfig
}
type ErrMustUpdate ¶
type ErrMustUpdate = supfile.ErrMustUpdate
Re-export types from subpackages to maintain compatibility
type ErrUnsupportedSupfileVersion ¶
type ErrUnsupportedSupfileVersion = supfile.ErrUnsupportedSupfileVersion
Re-export types from subpackages to maintain compatibility
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.Supfile)
func (*HelpDisplayer) ShowAll ¶
func (h *HelpDisplayer) ShowAll(conf *supfile.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.Supfile
InitialArgs *InitialArgs
}
type InitialArgs ¶
type InitialArgs struct {
Supfile string
EnvVars FlagStringSlice
SSHConfig string
OnlyHosts string
ExceptHosts string
Debug bool
DisablePrefix bool
ShowVersion bool
ShowExample bool
ShowHelp bool
DisableColor bool
TestConnections bool
CommandArgs []string
Force bool
}
InitialArgs contains values from flags during program init
var InitialArgsStore *InitialArgs = &InitialArgs{}
type Inventory ¶
type Inventory struct {
Bash bool
Sh bool
Arch string
Home string
User string
OsType string
IsLocal bool
}
func (*Inventory) CheckBashCommand ¶
func (*Inventory) CheckHomeCommand ¶
CheckHomeCommand returns the command to get the home directory based on the OS type
it's expected that it will run AFTER a call to check os type
func (*Inventory) CheckOsTypeCommand ¶
func (*Inventory) CheckShCommand ¶
func (*Inventory) CheckUserCommand ¶
func (*Inventory) DetectArchCommand ¶
func (*Inventory) GetHomeUnixCommand ¶
func (*Inventory) GetHomeWinCommand ¶
type PlayBook ¶
type PlayBook struct {
// contains filtered or unexported fields
}
func (*PlayBook) IsMakefileMode ¶
func (*PlayBook) MarkAsMakefileMode ¶
func (p *PlayBook) MarkAsMakefileMode()
type ShellCheckFacade ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.