Documentation ¶
Index ¶
- Constants
- Variables
- func ClientKeyAuth(keyFile string) (ssh.AuthMethod, error)
- func CreateDir(dir string) error
- func Debug(fields map[string]interface{}, msg string)
- func ErrKeyword(val interface{}) error
- func ErrNotValidVariable(val interface{}) error
- func ErrWrongType(field interface{}, val interface{}, _type string) error
- func Error(fields map[string]interface{}, msg string)
- func Fatal(fields map[string]interface{}, msg string)
- func GetInventoryGroups(planBuf []byte) ([]string, error)
- func HenchErr(err error, fields map[string]interface{}, extMsg string) error
- func Info(fields map[string]interface{}, msg string)
- func InitConfiguration(filename string) error
- func InitLog() error
- func MergeMap(src map[string]interface{}, dst map[string]interface{}, override bool)
- func PasswordAuth(pass string) (ssh.AuthMethod, error)
- func Printf(msg string, a ...interface{})
- func PrintfAndFill(size int, fill string, msg string, a ...interface{})
- func Println(msg string)
- func SprintfAndFill(size int, fill string, msg string, a ...interface{}) string
- func Warn(fields map[string]interface{}, msg string)
- type Configuration
- type HenchmanError
- type HostGroup
- type Inventory
- type InventoryConfig
- type InventoryInterface
- type LocalTransport
- type Machine
- type Module
- type Plan
- type PlanProxy
- type RegMap
- type SSHTransport
- type Task
- func (task *Task) ProcessWhen() (bool, error)
- func (task *Task) ProcessWithItems(varsMap VarsMap, regMap RegMap) ([]*Task, error)
- func (task Task) Render(vars VarsMap, registerMap RegMap) (*Task, error)
- func (task Task) RenderVars(varsMap VarsMap, registerMap map[string]interface{}) error
- func (task *Task) Run(machine *Machine, vars VarsMap, registerMap RegMap) (*TaskResult, error)
- type TaskProxy
- type TaskResult
- type TransportConfig
- type TransportInterface
- type VarsMap
- type VarsProxy
- type YAMLInventory
Constants ¶
const ( HENCHMAN_PREFIX = "henchman_" MODULES_TARGET = "modules.tar" IGNORED_EXTS = "zip,tar,tar.gz" REMOTE_DIR = "${HOME}/.henchman/" )
const ( ECHO = 53 TTY_OP_ISPEED = 128 TTY_OP_OSPEED = 129 )
const DEFAULT_CONFIGURATION = `` /* 205-byte string literal not displayed */
Variables ¶
var ( DebugFlag bool OsNames = []string{"darwin", "linux"} )
var ModuleSearchPath = []string{
"modules",
}
Functions ¶
func ClientKeyAuth ¶
func ClientKeyAuth(keyFile string) (ssh.AuthMethod, error)
func ErrKeyword ¶
func ErrKeyword(val interface{}) error
func ErrNotValidVariable ¶
func ErrNotValidVariable(val interface{}) error
func ErrWrongType ¶
func InitConfiguration ¶
FIXME: If a custom configuration is given, it should be merged with DEFAULT configuration
func MergeMap ¶
MergeMap(...) merges two map[string]interface{}. Source values will override dest values if override is true
func PasswordAuth ¶
func PasswordAuth(pass string) (ssh.AuthMethod, error)
func PrintfAndFill ¶
Does a printf and fills the extra white space Just specify the max size to fill to and the string to fill with
func SprintfAndFill ¶
Does a Sprintf and fills the extra white space
Types ¶
type Configuration ¶
var Config Configuration
Global config object for henchman to use
type HenchmanError ¶
type HenchmanError struct { Err error Fields map[string]interface{} // contains filtered or unexported fields }
func (*HenchmanError) Error ¶
func (henchError *HenchmanError) Error() string
type Inventory ¶
type Inventory struct { //GroupHosts map[string][]*Machine Groups map[string]HostGroup `yaml:"groups"` HostVars map[string]VarsMap `yaml:"host_vars"` GlobalVars VarsMap `yaml:"global_vars"` }
type Inventory map[string][]*Machine
func (*Inventory) GetInventoryForGroups ¶
*
- Returns a filtered inventory depending on which groups are specified
- Keeps the groups specified in the filtered inventory
func (*Inventory) GetMachines ¶
func (inv *Inventory) GetMachines(tc TransportConfig) ([]*Machine, error)
func (*Inventory) SetGlobalVarsFromInventoryGroups ¶
*
- Sets all_hosts, and groups with attached hosts lists
- These can be accessed in vars.inv.whatevs
type InventoryConfig ¶
type InventoryInterface ¶
type InventoryInterface interface {
Load(ic InventoryConfig) (Inventory, error)
}
type LocalTransport ¶
type LocalTransport struct{}
Transport for the current machine on which henchman is being run on
func NewLocal ¶
func NewLocal(config *TransportConfig) (*LocalTransport, error)
func (*LocalTransport) Initialize ¶
func (local *LocalTransport) Initialize(config *TransportConfig) error
type Machine ¶
type Machine struct { Hostname string Vars VarsMap Transport TransportInterface }
type Module ¶
FIXME: Have custom error types when parsing modules
type Plan ¶
func PreprocessPlan ¶
Calls the other Preprocessing Compenents
type PlanProxy ¶
type PlanProxy struct { Name string `yaml:"name"` Sudo bool `yaml:"sudo"` Debug bool `yaml:"debug"` TaskProxies []*TaskProxy `yaml:"tasks"` VarsProxy *VarsProxy `yaml:"vars"` InventoryGroups []string `yaml:"hosts"` }
func (PlanProxy) PreprocessTasks ¶
Checks the a slice of TaskProxy ptrs passed in by a Plan and determines whether if it's an include value or a normal task. If it's a normal task it appends it as a standard task, otherwise it recursively expands the include statement NOTE: making this a function of PlanProxy in case we want to have more plan level variables
in the future. Removes the need to pass each variable as a parameter.
func (PlanProxy) PreprocessVars ¶
Processes plan level vars with includes All plan level vars will be in the vars map And any repeat vars in the includes will be a FCFS priority NOTE: if the user has multiple include blocks it'll grab the one closest to
the bottom
type SSHTransport ¶
type SSHTransport struct { Host string Port uint16 Config *ssh.ClientConfig }
func NewSSH ¶
func NewSSH(config *TransportConfig) (*SSHTransport, error)
func (*SSHTransport) Initialize ¶
func (sshTransport *SSHTransport) Initialize(config *TransportConfig) error
type Task ¶
type Task struct { Id string Debug bool IgnoreErrors bool `yaml:"ignore_errors"` Local bool Module Module Name string Register string Retry int Sudo bool Vars VarsMap When string WithItems interface{} `yaml:"with_items"` }
func (*Task) ProcessWhen ¶
checks and converts when to bool
func (*Task) ProcessWithItems ¶
ProcessWithItems checks for the with_items files in a task. If it's present it will generate a list of rendered tasks.
func (Task) Render ¶
wrapper for Rendering each task This will return the rendered task and not manipulate the pointer to the task. b/c the pointer to the task is a template and a race condition can occur.
func (Task) RenderVars ¶
renders the task level variables with global vars
type TaskProxy ¶
type TaskProxy struct { Task `yaml:",inline"` SudoState string DebugState string Include string IncludeVars VarsMap `yaml:"vars"` }
Task is for the general Task format. Refer to task.go Vars are kept in scope for each Task. So there is a Vars field for each task Include is the file name for the included Tasks list
func (*TaskProxy) UnmarshalYAML ¶
Custom unmarshaller which accounts for module names
type TaskResult ¶
type TransportConfig ¶
type TransportInterface ¶
type VarsMap ¶
type VarsMap map[string]interface{}
NOTE: eventually change this to map[string]interface{}
type VarsProxy ¶
type VarsProxy struct {
Vars VarsMap
}
func (*VarsProxy) UnmarshalYAML ¶
Custom unmarshaller which account for multiple include statements and include types NOTE: Cannot account for double includes because unmarshal(&vMap) already does
under the hood unmarshaling and does what any map would do, which is override repeating key values
type YAMLInventory ¶
type YAMLInventory struct { Groups map[string]HostGroup `yaml:"groups"` HostVars map[string]VarsMap `yaml:"host_vars"` GlobalVars VarsMap `yaml:"global_vars"` }
FIXME: Have a way to provide specifics
func (*YAMLInventory) Load ¶
func (yi *YAMLInventory) Load(ic InventoryConfig) (Inventory, error)