fix: ubuntu deb package upgrade restart the service#218
Conversation
Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughpostinst refactors service lifecycle handling: ChangesService Installation Lifecycle
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 413ea057ad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🧹 Nitpick comments (1)
deployments/packages/scripts/postinst (1)
22-29: ⚖️ Poor tradeoffConsider respecting service enabled state during upgrade.
The upgrade path checks
is-activeto decide between restart and start, but doesn't checkis-enabled. If an administrator explicitly disabled the service before the upgrade, this logic will start it anyway, which may not respect the admin's intent.Consider checking enabled state first:
if [ -n "$2" ]; then # $2 is the previous version — Debian upgrade path echo "Upgrade detected - (re)starting service..." if systemctl is-enabled --quiet fleetintd.service; then if systemctl is-active --quiet fleetintd.service; then systemctl restart fleetintd.service || echo "[WARNING] Failed to restart service" else systemctl start fleetintd.service || echo "[WARNING] Failed to start service" fi else echo "Service is disabled - respecting admin configuration" fiNote: The current behavior does achieve the PR objective (restarting on upgrade), and the systemd unit's
Restart=alwayssuggests an always-on intent, so this may be acceptable depending on the desired policy.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@deployments/packages/scripts/postinst` around lines 22 - 29, The postinst upgrade block currently checks systemctl is-active for fleetintd.service and will start the service on upgrade even if it was previously disabled; update the logic in the upgrade branch (the if [ -n "$2" ... ] block) to first check systemctl is-enabled --quiet fleetintd.service and only attempt restart/start if enabled, otherwise echo a message like "Service is disabled - respecting admin configuration"; keep the existing restart vs start decision using systemctl is-active --quiet fleetintd.service and preserve the existing failure echo messages.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@deployments/packages/scripts/postinst`:
- Around line 22-29: The postinst upgrade block currently checks systemctl
is-active for fleetintd.service and will start the service on upgrade even if it
was previously disabled; update the logic in the upgrade branch (the if [ -n
"$2" ... ] block) to first check systemctl is-enabled --quiet fleetintd.service
and only attempt restart/start if enabled, otherwise echo a message like
"Service is disabled - respecting admin configuration"; keep the existing
restart vs start decision using systemctl is-active --quiet fleetintd.service
and preserve the existing failure echo messages.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: c512fa32-b939-4616-b18d-11002fa8432a
📒 Files selected for processing (1)
deployments/packages/scripts/postinst
Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>
Description
Checklist
Summary by CodeRabbit