Documentation
¶
Index ¶
Constants ¶
const ( TypeDeleteTestData = "DeleteTestData" TypeDownloadAsset = "DownloadAsset" TypeKeyValue = "KeyValue" TypeSetGroup = "SetGroup" TypeInstallTestRun = "InstallTestRun" TypeExecuteTestRun = "ExecuteTestRun" )
Task type constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseTask ¶
type BaseTask struct {
Type string `json:"type"`
}
BaseTask is a struct that is intended to be embedded by specific task structs. Both of these in conjunction are used primarily to house the JSON message for passing tasks over the comms package (i.e. message queue), but may also contain important dependencies of the task, such as an HTTP handler.
type DeleteTestData ¶
DeleteTestData embeds BaseTask and adds the necessary fields to transport a DeleteTestData task through comms
func NewDeleteTestData ¶
func NewDeleteTestData(uuid string) *DeleteTestData
NewDeleteTestData returns a new DeleteTestData tasks.
func (*DeleteTestData) Run ¶
func (t *DeleteTestData) Run(_ *config.Config, ac *cache.AgentCache, _ Responder) error
Run contains the logic necessary to perform this task on the agent.
type DownloadAsset ¶
DownloadAsset defines this particular task. It contains definitions not only for the task message, but also HTTPClient, filesystem, and i/o system abstractions to be more conducive to unit testing.
func NewDownloadAsset ¶
func NewDownloadAsset(assets []string) *DownloadAsset
NewDownloadAsset returns a new DownloadAsset task.
func (*DownloadAsset) Run ¶
func (t *DownloadAsset) Run(cfg *config.Config, _ *cache.AgentCache, _ Responder) error
Run contains the logic necessary to perform this task on the agent. This particular task will download all required assets, copy them into the appropriate directory, and ensure that the execute permission is given to each collector file.
type ExecuteTestRun ¶
type ExecuteTestRun struct { BaseTask TestUUID string `json:"test_uuid"` TimeLimit int `json:"time_limit"` }
ExecuteTestRun defines this particular task.
func NewExecuteTestRun ¶
func NewExecuteTestRun(testUUID string, timeLimit int) *ExecuteTestRun
NewExecuteTestRun returns a new ExecuteTestRun task.
func (*ExecuteTestRun) Run ¶
func (t *ExecuteTestRun) Run(cfg *config.Config, ac *cache.AgentCache, responder Responder) (err error)
Run contains the logic necessary to perform this task on the agent. This particular task will execute a testrun that has already been installed into the local agent cache. In this context (single agent), a testrun will be executed once per target, all in parallel.
type InstallTestRun ¶
InstallTestRun defines this particular task.
func NewInstallTestRun ¶
func NewInstallTestRun(tr defs.TestRun) *InstallTestRun
NewInstallTestRun returns a new InstallTestRun task.
func (*InstallTestRun) Run ¶
func (t *InstallTestRun) Run(cfg *config.Config, ac *cache.AgentCache, responder Responder) (err error)
Run contains the logic necessary to perform this task on the agent. This particular task will install, but not execute a testrun on this agent. The installation procedure will first run the referenced testlet in check mode to help ensure that the actual testrun execution can take place. If that succeeds, the testrun is installed in the agent cache.
type KeyValue ¶
KeyValue defines this particular task.
func NewKeyValue ¶
NewKeyValue returns a new KeyValue task.
type SetGroup ¶
SetGroup defines this particular task.
func NewSetGroup ¶
NewSetGroup returns a new SetGroup task.
type Task ¶
type Task interface { // TODO(mierdin): This works but is a little "meh". Basically, each task has to have a "Run()" function, as enforced // by this interface. If the task needs some additional data, it gets these through struct properties. This works but // doesn't quite feel right. Come back to this and see if there's a better way. Run(*config.Config, *cache.AgentCache, Responder) error }
Task is an interface to define task behavior This is used for functions like those in comms that need to work with all specific task types, not one specific task.