henchman

package
v0.0.0-...-916d208 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2015 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ECHO          = 53
	TTY_OP_ISPEED = 128
	TTY_OP_OSPEED = 129
)

Variables

View Source
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 ErrWrongType(field interface{}, val interface{}, _type string) error

func PasswordAuth

func PasswordAuth(pass string) (ssh.AuthMethod, error)

Types

type CustomUnmarshalError

type CustomUnmarshalError struct {
	Err error
}

func (*CustomUnmarshalError) Error

func (cue *CustomUnmarshalError) Error() string

type Inventory

type Inventory map[string][]*Machine

func (Inventory) Count

func (inv Inventory) Count() int

func (Inventory) Machines

func (inv Inventory) Machines() []*Machine

type InventoryConfig

type InventoryConfig map[string]string

type InventoryInterface

type InventoryInterface interface {
	Load(ic InventoryConfig, tc TransportConfig) (Inventory, error)
}

type Machine

type Machine struct {
	Hostname  string
	Transport TransportInterface
}

type Module

type Module struct {
	Name   string
	Params map[string]string
}

FIXME: Have custom error types when parsing modules

func NewModule

func NewModule(name string, params string) (*Module, error)

func (*Module) ExecOrder

func (module *Module) ExecOrder() ([]string, error)

func (*Module) Resolve

func (module *Module) Resolve() (modulePath string, err error)

Module not found

type Plan

type Plan struct {
	Name      string
	Inventory Inventory
	Vars      VarsMap
	Tasks     []*Task
}

func PreprocessPlan

func PreprocessPlan(buf []byte, inv Inventory) (*Plan, error)

For Plan NOTE: inventory should always be initialized and passed in?

or should we just check to see if it's nil?

func (*Plan) Execute

func (plan *Plan) Execute() error

type PlanProxy

type PlanProxy struct {
	Name            string       `yaml:"name"`
	Sudo            bool         `yaml:"sudo"`
	TaskProxies     []*TaskProxy `yaml:"tasks"`
	VarsProxy       *VarsProxy   `yaml:"vars"`
	InventoryGroups []string     `yaml:"hosts"`
}

type SSHTransport

type SSHTransport struct {
	Host   string
	Port   uint16
	Config *ssh.ClientConfig
}

func NewSSH

func NewSSH(config *TransportConfig) (*SSHTransport, error)

func (*SSHTransport) Exec

func (sshTransport *SSHTransport) Exec(cmd string, stdin []byte, sudoEnabled bool) (*bytes.Buffer, error)

func (*SSHTransport) Initialize

func (sshTransport *SSHTransport) Initialize(config *TransportConfig) error

func (*SSHTransport) Put

func (sshTransport *SSHTransport) Put(source, destination string, dstType string) error

type Task

type Task struct {
	Id           string
	Sudo         bool
	Name         string
	Module       *Module
	IgnoreErrors bool `yaml:"ignore_errors"`
	Local        bool
	When         string
	Register     string
	Vars         VarsMap
}

func PreprocessTasks

func PreprocessTasks(taskSection []*TaskProxy, planVars VarsMap, sudo bool) ([]*Task, error)

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

func (*Task) Render

func (task *Task) Render(input interface{}, output interface{}) error

Renders any pongo2 formatting and converts it back to a task

func (*Task) Run

func (task *Task) Run(machine *Machine) (*TaskResult, error)

type TaskProxy

type TaskProxy struct {
	Task    `yaml:",inline"`
	Include string
}

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

func (tp *TaskProxy) UnmarshalYAML(unmarshal func(interface{}) error) error

Custom unmarshaller which accounts for module names

type TaskResult

type TaskResult struct {
	State  string `json:"status"`
	Output string `json:"output,omitempty"`
	Msg    string `json:"msg"`
}

type TransportConfig

type TransportConfig map[string]string

type TransportInterface

type TransportInterface interface {
	Initialize(config *TransportConfig) error
	Exec(cmd string, stdin []byte, sudo bool) (*bytes.Buffer, error)
	Put(source string, destination string, dstType string) error
}

type VarsMap

type VarsMap map[interface{}]interface{}

func PreprocessVars

func PreprocessVars(vars VarsMap) (VarsMap, error)

type VarsProxy

type VarsProxy struct {
	Vars VarsMap
}

func (*VarsProxy) UnmarshalYAML

func (vp *VarsProxy) UnmarshalYAML(unmarshal func(interface{}) error) error

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 map[string][]string

FIXME: Have a way to provide specifics

func (*YAMLInventory) Load

Directories

Path Synopsis
Godeps
_workspace/src/github.com/stretchr/testify/assert
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
_workspace/src/github.com/stretchr/testify/require
Alternative testing tools which stop test execution if test failed.
Alternative testing tools which stop test execution if test failed.
_workspace/src/gopkg.in/yaml.v2
Package yaml implements YAML support for the Go language.
Package yaml implements YAML support for the Go language.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL