executeSetEnv sets an environment variable
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 1342 | |
| 1343 | // executeSetEnv sets an environment variable |
| 1344 | func (e *Executor) executeSetEnv(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
| 1345 | key, ok := action.Parameters["key"].(string) |
| 1346 | if !ok { |
| 1347 | return "", fmt.Errorf("key parameter required for setenv") |
| 1348 | } |
| 1349 | value, _ := action.Parameters["value"].(string) // optional |
| 1350 | |
| 1351 | resp, err := client.SetEnv(ctx, beaconID, key, value) |
| 1352 | if err != nil { |
| 1353 | return "", err |
| 1354 | } |
| 1355 | |
| 1356 | return e.fireAndForget(resp.TaskID, "setenv "+key+"="+value) |
| 1357 | } |
| 1358 | |
| 1359 | // executeExit tells the beacon to exit |
| 1360 | func (e *Executor) executeExit(ctx context.Context, client *csclient.Client, beaconID string) (string, error) { |
no test coverage detected