executeJobStop stops an active job
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 1368 | |
| 1369 | // executeJobStop stops an active job |
| 1370 | func (e *Executor) executeJobStop(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
| 1371 | jidVal, ok := action.Parameters["jid"] |
| 1372 | if !ok { |
| 1373 | return "", fmt.Errorf("jid parameter required for job_stop") |
| 1374 | } |
| 1375 | |
| 1376 | var jid int |
| 1377 | switch v := jidVal.(type) { |
| 1378 | case float64: |
| 1379 | jid = int(v) |
| 1380 | case int: |
| 1381 | jid = v |
| 1382 | default: |
| 1383 | return "", fmt.Errorf("jid parameter must be a number") |
| 1384 | } |
| 1385 | |
| 1386 | resp, err := client.JobStop(ctx, beaconID, jid) |
| 1387 | if err != nil { |
| 1388 | return "", err |
| 1389 | } |
| 1390 | |
| 1391 | return e.waitForOutput(ctx, client, resp.TaskID) |
| 1392 | } |
| 1393 | |
| 1394 | // storeBeaconMetadata stores beacon metadata in outputs map for condition evaluation |
| 1395 | func (e *Executor) storeBeaconMetadata() { |
no test coverage detected