Fix fleetctl generate-gitops when MDM is turned off - #30677
Conversation
WalkthroughThe changes update MDM-related generation logic in the Fleet GitOps command to ensure MDM data is only generated or retrieved when MDM is enabled and configured. Additionally, tests are added to verify that outputs are empty or minimal when MDM is disabled, and special error handling for unconfigured MDM states is removed. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GenerateGitopsCommand
participant AppConfig
participant MDMSubsystem
User->>GenerateGitopsCommand: generateControls(teamId)
GenerateGitopsCommand->>AppConfig: Check MDM.EnabledAndConfigured
alt MDM enabled and configured
GenerateGitopsCommand->>MDMSubsystem: Generate profiles, EULA, etc.
MDMSubsystem-->>GenerateGitopsCommand: Return MDM data
else MDM not enabled or configured
GenerateGitopsCommand-->>User: Return empty/minimal MDM data
end
GenerateGitopsCommand-->>User: Return controls output
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings🧬 Code Graph Analysis (1)cmd/fleetctl/fleetctl/generate_gitops_test.go (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (33)
🔇 Additional comments (7)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #30677 +/- ##
==========================================
+ Coverage 62.13% 64.12% +1.99%
==========================================
Files 1877 1878 +1
Lines 184526 184545 +19
Branches 5357 5357
==========================================
+ Hits 114657 118347 +3690
+ Misses 60687 56893 -3794
- Partials 9182 9305 +123
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
For unreleased bug #30656. - [X] Added/updated automated tests - [X] Manual QA for all new/changed functionality - [X] For unreleased bug fixes in a release candidate, confirmed that the fix is not expected to adversely impact load test results or alerted the release DRI if additional load testing is needed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved handling to ensure MDM-related data is only generated when MDM is enabled and properly configured. * Errors related to MDM configuration are now surfaced instead of being silently ignored. * **Tests** * Added new tests to verify correct behavior when MDM is disabled and not configured, ensuring empty or minimal outputs for MDM-related data in this scenario. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
…#30677) (#30687) For unreleased bug #30656. - [X] Added/updated automated tests - [X] Manual QA for all new/changed functionality - [X] For unreleased bug fixes in a release candidate, confirmed that the fix is not expected to adversely impact load test results or alerted the release DRI if additional load testing is needed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved handling to ensure MDM-related data is only generated when MDM is enabled and properly configured. * Errors related to MDM configuration are now surfaced instead of being silently ignored. * **Tests** * Added new tests to verify correct behavior when MDM is disabled and not configured, ensuring empty or minimal outputs for MDM-related data in this scenario. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
For unreleased bug #30656.
Summary by CodeRabbit
Bug Fixes
Tests