Version: v1.5.3 Latest Latest

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

Go to latest
Published: Jun 25, 2016 License: AGPL-3.0 Imports: 21 Imported by: 6




This section is empty.


View Source
var ErrNilReader = errors.New("Install: must have a non-nil Reader")

ErrNilReader is a generic error for when the reader is nil

View Source
var (
	ErrUnableToConnect = errors.New("RackspaceUpdater: unable to connect to rackspace.")


This section is empty.


type Artifact

type Artifact map[string]string

type Config

type Config struct {
	Name          string              `hcl:",key"`
	CheckInterval string              `hcl:"checkInterval"`
	UpdateTTL     string              `hcl:"updateTTL"`
	PostCommand   string              `hcl:"postCommand"`
	PreCommand    string              `hcl:"preCommand"`
	BeforeHooks   []HookDefinition    `hcl:"before"`
	AfterHooks    []HookDefinition    `hcl:"after"`
	Sequential    bool                `hcl:"sequentialUpdates"`
	RawArtifact   map[string]Artifact `hcl:"artifact,expand"`
	Artifact      Artifact            `hcl:"-"`
	Hash          string              `hcl:"hash"`
	Updater       Updater             `hcl:"-"`
	Locker        Locker              `hcl:"-"`

func LoadServices

func LoadServices(root string) (d []Config, err error)

type ConsulEventHook

type ConsulEventHook struct {
	// contains filtered or unexported fields

func NewConsulEventHook

func NewConsulEventHook(cfg map[string]string) ConsulEventHook

func (ConsulEventHook) Execute

func (h ConsulEventHook) Execute(config HookConfig, service Config) error

type ConsulLocker

type ConsulLocker struct {
	// contains filtered or unexported fields

ConsulLocker is a Locker that will use consul as the coordinator for establish a lock amongst multiple machines

func NewConsulLocker

func NewConsulLocker(cfg map[string]string) (*ConsulLocker, error)

func (ConsulLocker) Acquire

func (l ConsulLocker) Acquire(shutdownCh <-chan struct{}) (<-chan struct{}, error)

func (ConsulLocker) Release

func (l ConsulLocker) Release() error

type FileInstaller

type FileInstaller struct{}

FileInstaller defines an Installer that takes the reader and writes it to the dest directory.

func (FileInstaller) Install

func (i FileInstaller) Install(dest string, f io.Reader) (count int, err error)

Install will copy the given io.Reader to the destination path

type GraphiteEventHook

type GraphiteEventHook struct{}

func (GraphiteEventHook) Execute

func (h GraphiteEventHook) Execute(config HookConfig, service Config) error

type Hook

type Hook interface {
	Execute(config HookConfig, service Config) error

Hook is an interface that defines a method for executing custom behavior at certain hook points

func GetHookByName

func GetHookByName(name string) Hook

GetHookByName returns a hook by the id name given.

TODO(ChrisMcKenzie): this is kind of ugly and could probably be cleaned through the use of hooks being packages and registering with a hook manager

type HookConfig

type HookConfig map[string]string

type HookDefinition

type HookDefinition map[string]HookConfig

type Installer

type Installer interface {
	Install(dest string, r io.Reader) (int, error)

Installer is an interface that allows different methods of writing the given io.Reader to disk.

type Locker

type Locker interface {
	// Acquire takes a shutdownCh and return a lock chan and error
	// the lock chan can be used to block the process until the lock
	// has been acquired and the chan receives.
	Acquire(<-chan struct{}) (<-chan struct{}, error)
	// Release will release the lock allowing for other processes to
	// acquire.
	Release() error

Locker is an interface that allows you to block execution of another process across a set of machines.

type MetaData

type MetaData struct {
	ContentType string
	Hash        string

type RackspaceUpdater

type RackspaceUpdater struct {
	// contains filtered or unexported fields

func NewRackspaceUpdater

func NewRackspaceUpdater(config map[string]string) *RackspaceUpdater

func (*RackspaceUpdater) Download

func (u *RackspaceUpdater) Download(opt Artifact) (io.ReadCloser, MetaData, error)

func (*RackspaceUpdater) IsOutdated

func (u *RackspaceUpdater) IsOutdated(hash string, opts Artifact) (bool, error)

type S3Updater

type S3Updater struct {
	// contains filtered or unexported fields

S3Updater is an Updater for updating file that come from amazone s3

func NewS3Updater

func NewS3Updater(config map[string]string) *S3Updater

NewS3Updater will return a configured Updater for check against amazon s3

func (S3Updater) Download

func (u S3Updater) Download(config Artifact) (io.ReadCloser, MetaData, error)

Download is an Updater method that will download the requested file as an io.ReadCloser and return MetaData to the use about the file.

func (S3Updater) IsOutdated

func (u S3Updater) IsOutdated(hash string, config Artifact) (bool, error)

IsOutdated will check if a file is out of date by getting the ETag of the file and comparing it withe the current file.

type ScriptHook

type ScriptHook struct{}

ScriptHook defines a Hook that will run a specified command on a the machine.

func (ScriptHook) Execute

func (h ScriptHook) Execute(config HookConfig, service Config) error

Execute is a Hook method to execut the hook with standard options

type ServiceFile

type ServiceFile struct {
	Services []Config `hcl:"service,expand"`

type TarInstaller

type TarInstaller struct{}

TarInstaller Defines an install Method that takes a destination path and a io.Reader and untars and gzip decodes a tarball and places the files inside on the FS with `dest` as their root It returns the number of files written and an error

func (TarInstaller) Install

func (i TarInstaller) Install(dest string, fr io.Reader) (count int, err error)

Install defines the Installer required function that will in this case untar and copy files to the destination directory

type TemplateData

type TemplateData struct {
	Hostname string

TemplateData specifies some system configurations that can be used in hook options using go template syntax

type Updater

type Updater interface {
	IsOutdated(hash string, opts Artifact) (bool, error)
	Download(Artifact) (io.ReadCloser, MetaData, error)

Updater is an interface that defines methods for checking a files freshness and downloading an updated version if needed.

Jump to

Keyboard shortcuts

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