MCPcopy Create free account
hub / github.com/Xenov-X/csbot / executeJobStop

Method executeJobStop

workflow/executor.go:1370–1392  ·  view source on GitHub ↗

executeJobStop stops an active job

(ctx context.Context, client *csclient.Client, beaconID string, action Action)

Source from the content-addressed store, hash-verified

1368
1369// executeJobStop stops an active job
1370func (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
1395func (e *Executor) storeBeaconMetadata() {

Callers 1

executeActionMethod · 0.95

Calls 1

waitForOutputMethod · 0.95

Tested by

no test coverage detected