runner

package
Version: v0.0.0-...-f0e7cc0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	// Cmd is a path to executable (script or binary) and arguments
	Cmd []string `json:"cmd"`

	// Description provides a basic check description.
	Description string `json:"description"`

	// Timeout is defines a custom script timeout.
	Timeout string `json:"timeout"`

	// Roles is a list of DC/OS roles (e.g. master, agent). Node must be one of roles
	// to execute a check.
	Roles []string `json:"roles"`
}

Check is a basic structure that describes DC/OS check.

func (*Check) Run

func (c *Check) Run(ctx context.Context, role string, env []string) ([]byte, int, error)

Run executes the given check.

type CombinedResponse

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

CombinedResponse represents a parent structure for multiple checks.

func NewCombinedResponse

func NewCombinedResponse(list bool) *CombinedResponse

NewCombinedResponse initiates a new instance of CombinedResponse.

func (CombinedResponse) MarshalJSON

func (cr CombinedResponse) MarshalJSON() ([]byte, error)

MarshalJSON is a custom json marshaller implementation used to return the appropriate response based on user input. combinedResponseError is used to return back error message if runner was unable to execute a check. CombinedResponse.Checks is used to return back a list of checks without executing them, combinedResponseSuccess is used to return user the actual checks output.

func (CombinedResponse) Status

func (cr CombinedResponse) Status() int

Status returns checks combined status.

type Response

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

Response provides a command Response.

func (Response) MarshalJSON

func (r Response) MarshalJSON() ([]byte, error)

MarshalJSON is a custom json marshaller implementation used to return output based on user request. responseList is returned if a user requested to list the checks. response is used to return back the result with populated Output and executable return code.

type Runner

type Runner struct {
	ClusterChecks map[string]*Check `json:"cluster_checks"`
	NodeChecks    struct {
		Checks    map[string]*Check `json:"checks"`
		PreStart  []string          `json:"prestart"`
		PostStart []string          `json:"poststart"`
	} `json:"node_checks"`
	CheckEnv map[string]string `json:"check_env"`
	// contains filtered or unexported fields
}

Runner is a main instance of DC/OS check runner.

func NewRunner

func NewRunner(role string) *Runner

NewRunner returns an initialized instance of *Runner.

func (*Runner) Cluster

func (r *Runner) Cluster(ctx context.Context, list bool, selectiveChecks ...string) (*CombinedResponse, error)

Cluster executes cluster runner defined in config.

func (*Runner) Load

func (r *Runner) Load(reader io.Reader) error

Load loads values to Runner struct from io.Reader

func (*Runner) LoadFromFile

func (r *Runner) LoadFromFile(path string) error

LoadFromFile opens a config file and try to load the values to Runner struct.

func (*Runner) PostStart

func (r *Runner) PostStart(ctx context.Context, list bool, selectiveChecks ...string) (*CombinedResponse, error)

PostStart executes the runner defined in config node_checks->poststart.

func (*Runner) PreStart

func (r *Runner) PreStart(ctx context.Context, list bool, selectiveChecks ...string) (*CombinedResponse, error)

PreStart executes the runner defined in config node_checks->prestart.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL