(
connection: sqlite3.Connection, args: argparse.Namespace
)
| 1327 | |
| 1328 | |
| 1329 | def set_capability_preflight( |
| 1330 | connection: sqlite3.Connection, args: argparse.Namespace |
| 1331 | ) -> dict[str, Any]: |
| 1332 | workspace = require_workspace(connection, args.workspace_id) |
| 1333 | if workspace["active_scan_id"]: |
| 1334 | raise SystemExit("Cannot update capability preflight after a scan has started.") |
| 1335 | checked_target_path = str(require_target(args.checked_target_path)) |
| 1336 | preflight_json = capability_preflight_json( |
| 1337 | capability_preflight_input( |
| 1338 | args.capability_preflight_json, args.capability_preflight_json_file |
| 1339 | ), |
| 1340 | checked_target_path=checked_target_path, |
| 1341 | checked_mode=args.checked_mode, |
| 1342 | ) |
| 1343 | timestamp = now() |
| 1344 | with connection: |
| 1345 | updated = connection.execute( |
| 1346 | """ |
| 1347 | UPDATE workspaces |
| 1348 | SET capability_preflight_json = ?, updated_at = ? |
| 1349 | WHERE id = ? AND active_scan_id IS NULL |
| 1350 | """, |
| 1351 | (preflight_json, timestamp, workspace["id"]), |
| 1352 | ) |
| 1353 | if updated.rowcount != 1: |
| 1354 | raise SystemExit("Cannot update capability preflight after a scan has started.") |
| 1355 | return workspace_state(connection, workspace["id"]) |
| 1356 | |
| 1357 | |
| 1358 | def begin_diff_resolution( |
no test coverage detected