Fix node/panel image uninstall: avoid brittle parsing#14
Fix node/panel image uninstall: avoid brittle parsing#14TaraRostami wants to merge 2 commits intoPasarGuard:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 WalkthroughBoth Changes
Sequence DiagramsequenceDiagram
participant User
participant Script
participant Docker as Docker CLI
participant Images as Docker Images
participant Containers as Docker Containers
User->>Script: Call uninstall function
Script->>Docker: Query images with filter
Docker-->>Script: Return image list
alt No images found
Script->>User: Print "images not found"
Script-->>User: Return early
else Images exist
loop For each image
Script->>Docker: Query containers using image
Docker->>Containers: Check ancestry
Containers-->>Docker: Return container list
Docker-->>Script: Report containers
alt Image in use
Script->>User: Report containers blocking removal
else Image not in use
Script->>Docker: Remove image
Docker->>Images: Delete image
Images-->>Docker: Success/Failure
Docker-->>Script: Report result
Script->>User: Print removal status
end
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This PR fixes
uninstall_node_docker_images()anduninstall_pasarguard_docker_images()by removing brittle parsing ofdocker imagesoutput.The previous implementation relied on
awk '{print $3}', which assumes a stable column layout and can extract the wrong field on newer Docker versions / different CLI formatting, causingdocker rmito fail silently.The updated implementation uses
docker images --formatfor stable extraction, filters only the intended repo (e.g. pasarguard/node), and skips removing images still used by any container.Old docker:

New docker:

Summary by CodeRabbit