Skip to content

Commit

Permalink
add debug steps
Browse files Browse the repository at this point in the history
Signed-off-by: Sumit Jaiswal <[email protected]>
  • Loading branch information
justjais committed Jun 6, 2024
1 parent 79ccf54 commit 0a60894
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
14 changes: 3 additions & 11 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Remote Attach",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost:5678",
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
]
}
"justMyCode": false
},
]
}
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,23 @@ git clone [email protected]:ansible/ansible-risk-insight.git
cd ansible-risk-insight
pip install -e .
```

## Debugging ARI over VSCode (for development)

ARI can be debugged using VSCode. Steps to start debugging:

Step 1: Please add below line to fine that needs to be debugged:
```
import debugpy
debugpy.listen(5678)
debugpy.wait_for_client()
```
Step 2: Fire the ARI command via cli command to run the ARI, ref as:
```
(.env) ➜ ari project <GH repository> --out-dir /tmp/CS --save-only-rule-result --scan-per-target --task-num-threshold 100 --fix
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
```
Step 3: From VSCode, click `Run->Start Debugging`, debugger should stop at the breakpoints placed inside the ARI code.

0 comments on commit 0a60894

Please sign in to comment.