core

package
v0.0.0-...-7db67c4 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2015 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const READ_BUFFER_SIZE = 1024

Variables

This section is empty.

Functions

func LogOutput

func LogOutput(runner *Local)

func RunAll

func RunAll(runner Runner, config *Config) error

func RunStep

func RunStep(runner Runner, s *ConfigStep) error

func RunTask

func RunTask(runner Runner, config *Config, taskName string) error

func StopAllPlugins

func StopAllPlugins()

BUG(Tobscher) Send signal to gracefully shutdown the plugin BUG(Tobscher) Use lock

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(name string, args []string) (*Command, error)

func (*Command) Args

func (c *Command) Args() []string

func (*Command) Name

func (c *Command) Name() string

type Config

type Config struct {
	Vars         map[string]string
	ServerGroups map[string][]ConfigServer
	Tasks        map[string]ConfigTask
	Triggers     map[string]ConfigEvent
	Interfaces   ConfigInterfaces
}

func NewConfig

func NewConfig() (*Config, error)

func (*Config) GetServerGroup

func (c *Config) GetServerGroup(name string) ([]ConfigServer, error)

func (*Config) Load

func (c *Config) Load(filepath string) error

type ConfigEvent

type ConfigEvent struct {
	Type        string
	Period      uint
	Endpoint    string
	Secret      string
	ServerGroup string
	Task        string
}

type ConfigInterfaces

type ConfigInterfaces struct {
	Web ConfigWebInterface
}

type ConfigServer

type ConfigServer struct {
	Host       string
	Username   string
	Password   string
	Port       string
	KeyPath    string `yaml:"key_path"`
	RunLocally bool   `yaml:"run_locally"`
	Vars       map[string]string
}

type ConfigStep

type ConfigStep struct {
	Plugin  *string
	Command *string
	Options map[string]interface{}
	Args    []string
}

type ConfigTask

type ConfigTask struct {
	Steps []ConfigStep
}

type ConfigWebInterface

type ConfigWebInterface struct {
	Settings map[string]string
	Users    []ConfigWebUsers
}

type ConfigWebUsers

type ConfigWebUsers struct {
	Username string
	Password string
}

type Local

type Local struct {
	ChStdOut chan []byte
	ChStdErr chan []byte
}

func NewLocalRunner

func NewLocalRunner() (*Local, error)

func (*Local) Close

func (l *Local) Close()

func (*Local) Run

func (l *Local) Run(task Task) error

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func GetPlugin

func GetPlugin(name string) (*Plugin, error)

func StartPlugin

func StartPlugin(name string) (*Plugin, error)

func (*Plugin) GetCommands

func (p *Plugin) GetCommands(args shared.Args) ([]*Command, error)

type PluginCache

type PluginCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

PluginCache stores loaded plugins

type PluginInformation

type PluginInformation struct {
	Host string
	Port string
	Cmd  *exec.Cmd
}

func (*PluginInformation) Address

func (p *PluginInformation) Address() string

type Remote

type Remote struct {
	Client *ssh.Client
}

Remote describes a runner which runs task on a remote system via SSH.

func NewRemoteRunner

func NewRemoteRunner(options ConfigServer) (*Remote, error)

NewRemoteRunner creates a new runner which runs tasks on a remote system.

An SSH connection will be establishe.

func (*Remote) Close

func (r *Remote) Close()

Close closes the SSH connection to the remote system

func (*Remote) Run

func (r *Remote) Run(task Task) error

Run runs the given task on the remote system

type Runner

type Runner interface {
	Run(Task) error
	Close()
}

type Task

type Task interface {
	Name() string
	Args() []string
}

Notes

Bugs

  • Send signal to gracefully shutdown the plugin

  • Use lock

Jump to

Keyboard shortcuts

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