fix issue when end_user_license_agreeement is defined but value is nil or empty string - #30595
Conversation
WalkthroughThe change updates the logic for handling the "end_user_license_agreement" field in the MDM app configuration map during the GitOps application process. It now explicitly checks for the field's presence and value, assigns an appropriate value to Changes
Poem
✨ 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 (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
server/service/client.go (1)
1805-1810: LGTM! The logic correctly handles all edge cases for the EULA field.The new conditional logic properly addresses the issue described in the PR by explicitly handling when
end_user_license_agreementis nil, empty string, or non-existent. The fix ensureseulaPathis consistently set and the key is always removed from the map.Consider this minor refactor for improved readability and explicit edge case handling:
- if endUserLicenseAgreement, exists := mdmAppConfig["end_user_license_agreement"]; !exists || endUserLicenseAgreement == nil || (endUserLicenseAgreement == "") { - eulaPath = "" - } else if eulaStr, ok := endUserLicenseAgreement.(string); ok && len(eulaStr) > 0 { - eulaPath = eulaStr + if endUserLicenseAgreement, exists := mdmAppConfig["end_user_license_agreement"]; !exists || endUserLicenseAgreement == nil { + eulaPath = "" + } else if eulaStr, ok := endUserLicenseAgreement.(string); ok { + if len(eulaStr) > 0 { + eulaPath = eulaStr + } else { + eulaPath = "" + } + } else { + // Handle non-string types explicitly + eulaPath = "" }This makes the handling of empty strings and non-string types more explicit, though the current implementation is functionally correct.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
server/service/client.go(1 hunks)
⏰ 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). (32)
- GitHub Check: test-db-changes
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript)
- GitHub Check: test-preview (ubuntu-latest)
- GitHub Check: test-go (main, ubuntu-latest, mysql:8.0.36, false)
- GitHub Check: test-go (mysql, ubuntu-latest, mysql:8.0.36, false)
- GitHub Check: test-go (vuln, ubuntu-latest, mysql:8.0.36, false)
- GitHub Check: test-go (service, ubuntu-latest, mysql:8.0.36, false)
- GitHub Check: test-go (fleetctl, ubuntu-latest, mysql:8.0.36, false)
- GitHub Check: test-go (vuln, ubuntu-latest, mysql:9.3.0, false)
- GitHub Check: test-go (service, ubuntu-latest, mysql:9.3.0, false)
- GitHub Check: check-doc-gen
- GitHub Check: build-and-check
- GitHub Check: test-go (scripts, ubuntu-latest, mysql:8.0.36, false)
- GitHub Check: test-go (mysql, ubuntu-latest, mysql:9.3.0, false)
- GitHub Check: test-go (main, ubuntu-latest, mysql:9.3.0, false)
- GitHub Check: test-go (integration-enterprise, ubuntu-latest, mysql:8.0.36, false)
- GitHub Check: test-go (integration-mdm, ubuntu-latest, mysql:9.3.0, false)
- GitHub Check: test-go (integration-enterprise, ubuntu-latest, mysql:9.3.0, false)
- GitHub Check: test-go (integration-core, ubuntu-latest, mysql:8.0.36, false)
- GitHub Check: test-go (integration-mdm, ubuntu-latest, mysql:8.0.36, false)
- GitHub Check: publish
- GitHub Check: test-packaging (ubuntu-latest, local)
- GitHub Check: test-go (fleetctl, ubuntu-latest, mysql:9.3.0, false)
- GitHub Check: test-go (integration-core, ubuntu-latest, mysql:9.3.0, false)
- GitHub Check: test-go (fast, ubuntu-latest, mysql:8.0.36, false)
- GitHub Check: test-packaging (ubuntu-latest, remote)
- GitHub Check: build-binaries
- GitHub Check: lint (windows-latest)
- GitHub Check: lint (ubuntu-latest)
- GitHub Check: lint (macos-latest)
- GitHub Check: test-go-nanomdm
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #30595 +/- ##
==========================================
- Coverage 64.07% 64.07% -0.01%
==========================================
Files 1878 1878
Lines 184482 184519 +37
Branches 5399 5399
==========================================
+ Hits 118213 118233 +20
- Misses 56948 56964 +16
- Partials 9321 9322 +1
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:
|
relates to #28691
This fixes an issue where
end_user_license_agreeementis defined but is an empty string or nil.Summary by CodeRabbit