master

package
v0.0.0-...-3da3ec5 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package master is the gofigure reference client library with helper functions.

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug = true
)

Functions

func BootstrapCmd

func BootstrapCmd() (map[string]*Client, error)

func BootstrapMany

func BootstrapMany(sshConfigPath string, executable string, minionConfigs map[string]*MinionConfig, masterCreds *Creds) (map[string]*Client, error)

BootstrapMany calls Bootstrap for many hosts in parallel.

func CheckExec

func CheckExec(client *Client, args []string, timeoutSecs int) (*pb.ExecResult, error)

func ConnectGRPC

func ConnectGRPC(address, caFile, certFile, keyFile string) (*grpc.ClientConn, error)

ConnectGRPC attempts to connect over GRPC to the remote address. It returns only a GRPC connection, not a gofigure client.

func CopyFile

func CopyFile(client *Client, src, dst, owner, group, mode string, timeoutSecs int) (*pb.FileResult, error)

func DeferredExit

func DeferredExit(clients map[string]*Client)

func Delete

func Delete(client *Client, path string, recursive bool, timeoutSecs int) (*pb.DeleteResult, error)

func Directory

func Directory(client *Client, path, owner, group, mode string, timeoutSecs int) (*pb.DirectoryResult, error)

func Exec

func Exec(client *Client, args []string, timeoutSecs int) (*pb.ExecResult, error)

You probably want CheckExec instead. This one won't error for non-zero return codes

func Exit

func Exit(clients map[string]*Client) error

func File

func File(client *Client, path, owner, group, mode string, content []byte, timeoutSecs int) (*pb.FileResult, error)

func LineInFile

func LineInFile(client *Client, path, owner, group, mode, regex, line string, timeoutSecs int) (*pb.LineInFileResult, error)

func Lines

func Lines(s string) []string

func RunAll

func RunAll(clients map[string]*Client, f func(host string, client *Client) error) error

RunAll is a helper function for running a function on many clients in parallel.

func Stat

func Stat(client *Client, path string, timeoutSecs int) (*pb.StatResult, error)

func TemplateFile

func TemplateFile(client *Client, path, owner, group, mode, templatePath string, args interface{}, timeoutSecs int) (*pb.FileResult, error)

Types

type Client

type Client struct {
	pb.GofigureClient
}

Client is a concrete example implementation of the local side of the gofigure configuration management tool.

func Bootstrap

func Bootstrap(host, sshConfigPath, executable string, minionConfig *MinionConfig, masterCreds *Creds) (*Client, error)

Bootstrap will parse an openssh config file, ssh to the remote host, copy the executable there, run it, and attempt to connect, returning a gofigure client.

type Config

type Config struct {
	Defaults *MinionConfig
	Master   *Creds
	Minions  map[string]*MinionConfig
}

type Creds

type Creds struct {
	CAFile   string
	CertFile string
	KeyFile  string
}

type MinionConfig

type MinionConfig struct {
	Bind  net.IP
	Port  int
	Creds *Creds
}

Jump to

Keyboard shortcuts

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