Skip to content

fix: ubuntu deb package upgrade restart the service#218

Merged
jingxiang-z merged 2 commits into
mainfrom
fix/ubuntu-package-upgrade
Jun 11, 2026
Merged

fix: ubuntu deb package upgrade restart the service#218
jingxiang-z merged 2 commits into
mainfrom
fix/ubuntu-package-upgrade

Conversation

@jingxiang-z

@jingxiang-z jingxiang-z commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Description

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • Bug Fixes
    • Refined install/upgrade behavior for the bundled service: fresh installs enable and start the service, while upgrades and configuration runs now only restart the service if it is already running, avoiding unintended service starts. This reduces unexpected service restarts and improves stability during package operations.

Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2da02f8b-7c4e-4027-af14-d4d4f1b96d09

📥 Commits

Reviewing files that changed from the base of the PR and between 413ea05 and 21f02aa.

📒 Files selected for processing (1)
  • deployments/packages/scripts/postinst

📝 Walkthrough

Walkthrough

postinst refactors service lifecycle handling: configure is now distinct from install|1 and uses $2 to choose upgrade-aware restart vs fresh-install enable+start; upgrade|2 now restarts only if the service is active and does not start it when inactive.

Changes

Service Installation Lifecycle

Layer / File(s) Summary
Configure: distinguish upgrade vs fresh-install
deployments/packages/scripts/postinst
configure was split from install|1. If $2 (previous version) is set, the script restarts fleetintd.service only when it is active; if $2 is empty, it enables and starts the service (fresh install).
Upgrade: restart-only when active
deployments/packages/scripts/postinst
upgrade|2 now restarts fleetintd.service only if the service is currently active and explicitly avoids starting it when inactive.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

A rabbit nudges systemd doors,
Checks the past, then taps once more.
If service slept and upgrade calls, it won't start—
Only if awake will it play its part.
Hops away, config tidy, system smart. 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: fixing service restart behavior during Ubuntu .deb package upgrades, which aligns with the core modification in the postinst script.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ubuntu-package-upgrade

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread deployments/packages/scripts/postinst Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
deployments/packages/scripts/postinst (1)

22-29: ⚖️ Poor tradeoff

Consider respecting service enabled state during upgrade.

The upgrade path checks is-active to decide between restart and start, but doesn't check is-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"
    fi

Note: The current behavior does achieve the PR objective (restarting on upgrade), and the systemd unit's Restart=always suggests 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

📥 Commits

Reviewing files that changed from the base of the PR and between c1bab9c and 413ea05.

📒 Files selected for processing (1)
  • deployments/packages/scripts/postinst

Signed-off-by: Jingxiang Zhang <jingzhang@nvidia.com>
@jingxiang-z jingxiang-z requested a review from rsampaio June 11, 2026 17:28
@jingxiang-z jingxiang-z self-assigned this Jun 11, 2026
Comment thread deployments/packages/scripts/postinst
@jingxiang-z jingxiang-z merged commit 622a26e into main Jun 11, 2026
9 checks passed
@jingxiang-z jingxiang-z deleted the fix/ubuntu-package-upgrade branch June 11, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants