shell

package
v0.0.0-...-1d50e38 Latest Latest
Warning

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

Go to latest
Published: May 30, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShellPluginName = "shell"
	ShellExecCmd    = "exec"
	CleanupCmd      = "cleanup"
	TrackCmd        = "track"
)

Variables

This section is empty.

Functions

func KillSpawnedProcs

func KillSpawnedProcs(taskId string, pluginLogger plugin.Logger) error

KillSpawnedProcs cleans up any tasks that were spawned by the given task.

Types

type CleanupCommand

type CleanupCommand struct{}

func (*CleanupCommand) Execute

func (cc *CleanupCommand) Execute(pluginLogger plugin.Logger,
	pluginCom plugin.PluginCommunicator, conf *model.TaskConfig, stop chan bool) error

Execute starts the shell with its given parameters.

func (*CleanupCommand) Name

func (cc *CleanupCommand) Name() string

func (*CleanupCommand) ParseParams

func (cc *CleanupCommand) ParseParams(params map[string]interface{}) error

ParseParams reads in the command's parameters.

func (*CleanupCommand) Plugin

func (cc *CleanupCommand) Plugin() string

type ShellExecCommand

type ShellExecCommand struct {
	// Script is the shell code to be run on the agent machine.
	Script string `mapstructure:"script" plugin:"expand"`

	// Silent, if set to true, prevents shell code/output from being
	// logged to the agent's task logs. This can be used to avoid
	// exposing sensitive expansion parameters and keys.
	Silent bool `mapstructure:"silent"`

	// Shell describes the shell to execute the script contents
	// with. Defaults to "sh", but users can customize to
	// explicitly specify another shell.
	Shell string `mapstructure:"shell"`

	// Background, if set to true, prevents shell code/output from
	// waiting for the script to complete and immediately returns
	// to the caller
	Background bool `mapstructure:"background"`

	// WorkingDir is the working directory to start the shell in.
	WorkingDir string `mapstructure:"working_dir"`

	// SystemLog if set will write the shell command's output to the system logs, instead of the
	// task logs. This can be used to collect diagnostic data in the background of a running task.
	SystemLog bool `mapstructure:"system_log"`

	// ContinueOnError determines whether or not a failed return code
	// should cause the task to be marked as failed. Setting this to true
	// allows following commands to execute even if this shell command fails.
	ContinueOnError bool `mapstructure:"continue_on_err"`
}

ShellExecCommand is responsible for running the shell code.

func (*ShellExecCommand) Execute

func (sec *ShellExecCommand) Execute(pluginLogger plugin.Logger,
	pluginCom plugin.PluginCommunicator,
	conf *model.TaskConfig,
	stop chan bool) error

Execute starts the shell with its given parameters.

func (*ShellExecCommand) Name

func (_ *ShellExecCommand) Name() string

func (*ShellExecCommand) ParseParams

func (sec *ShellExecCommand) ParseParams(params map[string]interface{}) error

ParseParams reads in the command's parameters.

func (*ShellExecCommand) Plugin

func (_ *ShellExecCommand) Plugin() string

type ShellPlugin

type ShellPlugin struct{}

ShellPlugin runs arbitrary shell code on the agent's machine.

func (*ShellPlugin) Name

func (sp *ShellPlugin) Name() string

Name returns the name of the plugin. Required to fulfill the Plugin interface.

func (*ShellPlugin) NewCommand

func (sp *ShellPlugin) NewCommand(cmdName string) (plugin.Command, error)

NewCommand returns the requested command, or returns an error if a non-existing command is requested.

type TrackCommand

type TrackCommand struct{}

func (*TrackCommand) Execute

func (cc *TrackCommand) Execute(pluginLogger plugin.Logger,
	pluginCom plugin.PluginCommunicator, conf *model.TaskConfig, stop chan bool) error

Execute starts the shell with its given parameters.

func (*TrackCommand) Name

func (cc *TrackCommand) Name() string

func (*TrackCommand) ParseParams

func (cc *TrackCommand) ParseParams(params map[string]interface{}) error

func (*TrackCommand) Plugin

func (cc *TrackCommand) Plugin() string

Jump to

Keyboard shortcuts

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