revamp 'cscli console status' to be all-in-one - #4592
Conversation
|
@buixor: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
|
@buixor: There are no area labels on this PR. You can add as many areas as you see fit.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
There was a problem hiding this comment.
Pull request overview
This PR revamps cscli console status into an all-in-one status report that always succeeds, showing both local sharing options and (when possible) the live Console/CAPI/PAPI connection state. It also centralizes CAPI/PAPI status querying logic so capi, papi, and console status commands report consistent information.
Changes:
- Add shared
core/consolestatushelpers for querying CAPI authentication/enrollment/subscription and PAPI permissions/last-order timestamp. - Update
cscli console statusoutput (human/json/raw) to include a “Console connection” section and to removeconsole_managementfrom “sharing options”. - Adjust config/test behavior so a fully empty online credentials file is treated as “not registered” (normal state) rather than a “missing field” misconfiguration.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/bats/09_console.bats | Updates console status expectations; adds coverage for “not registered” and “missing credentials file” behavior. |
| test/bats/04_capi.bats | Updates CAPI status test to treat fully empty credentials as “not registered” with a clearer message. |
| pkg/csconfig/console.go | Introduces CONSOLE_SHARE_CONFIGS to exclude console_management from sharing-options display. |
| pkg/csconfig/api.go | Treats an empty CAPI credentials file as “not registered” (debug log, no warning). |
| cmd/crowdsec-cli/core/consolestatus/consolestatus.go | New shared package for CAPI/PAPI live-status querying and decision-management derivation. |
| cmd/crowdsec-cli/clipapi/papi.go | Refactors cscli papi status to use consolestatus.QueryPAPIInfo. |
| cmd/crowdsec-cli/cliconsole/console.go | Makes cscli console status resilient to missing/invalid online creds; adds enriched JSON output and removes console_management from raw output. |
| cmd/crowdsec-cli/cliconsole/console_table.go | Adds a “Console connection” table and limits sharing options to CONSOLE_SHARE_CONFIGS. |
| cmd/crowdsec-cli/clicapi/capi.go | Refactors cscli capi status to use consolestatus.QueryCAPIStatus. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4592 +/- ##
==========================================
- Coverage 64.35% 63.79% -0.57%
==========================================
Files 499 517 +18
Lines 38550 39372 +822
==========================================
+ Hits 24808 25116 +308
- Misses 11415 11883 +468
- Partials 2327 2373 +46
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/kind enhancement |
No description provided.