Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from netdata:master #302

Merged
merged 3 commits into from
Jan 16, 2025
Merged

Conversation

pull[bot]
Copy link

@pull pull bot commented Jan 16, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

Summary by Sourcery

Disable auto-updates before uninstalling files and improve systemd unit handling.

New Features:

  • Added a function to check for the existence of systemd units.

Bug Fixes:

  • Fixed a bug where the uninstaller would not disable auto-updates before removing files.
  • Fixed a bug where systemd units were not correctly removed during uninstallation.

Enhancements:

  • Improved the reliability of systemd unit management during installation and uninstallation.

Ferroin and others added 3 commits January 16, 2025 07:58
* Query systemd for unit file paths on install/uninstall.

This makes our installation code more portable and more concise, and
should make the uninstallation code significantly more robust.

Also includes a number of other improvements to systemd handling and
updater handling in the uninstaller that should make it much more
thorough and reliable.

* Fix issues brought up in code review, and better support old systemd versions.

* Replace sed with AWK for readability.

* Fix uninstaller loop.

* Fix unit file detection in updater code.
…19413)

* add "netdata-" prefix for streaming and metrics-cardinality functions

* update priority
@pull pull bot added the ⤵️ pull label Jan 16, 2025
@pull pull bot merged commit a1f3b74 into webfutureiorepo:master Jan 16, 2025
Copy link

sourcery-ai bot commented Jan 16, 2025

Reviewer's Guide by Sourcery

This pull request updates the uninstaller and updater scripts to improve handling of systemd units and updater files. It also modifies the naming and priority of certain API functions and updates the license file handling in the Windows packaging script.

Sequence diagram for improved uninstaller process

sequenceDiagram
    participant U as Uninstaller
    participant S as Systemd
    participant F as File System

    U->>U: Check if systemd is present
    U->>F: Disable auto-updates
    U->>S: Disable systemd units
    U->>S: Stop systemd units
    loop For each unit
        U->>S: Get unit path
        U->>S: Get override paths
        U->>F: Remove unit files
    end
    U->>F: Remove systemd configs
    U->>S: Reload daemon
    U->>F: Remove remaining files
Loading

Sequence diagram for enhanced auto-update process

sequenceDiagram
    participant U as Updater
    participant S as Systemd

    U->>S: Check if systemd exists
    U->>S: Check if timer unit exists
    alt Timer unit exists
        U->>S: Enable timer
        U->>S: Start timer
    else Timer unit missing
        U->>U: Report error
    end
Loading

Flow diagram for systemd service directory selection

flowchart TD
    A[Start] --> B{Get systemd unit paths}
    B -->|Success| C[Filter lib paths]
    B -->|Fallback| D[Use default paths]
    C --> E[Filter etc paths]
    D --> F{Check each path}
    E --> F
    F -->|Found writable dir| G[Return path]
    F -->|Not found| H[Try next path]
    H --> F
Loading

File-Level Changes

Change Details Files
Improved handling of systemd units in the uninstaller
  • Disables and stops netdata and netdata-updater systemd units before removing their files.
  • Removes systemd unit files and associated configuration.
  • Reloads the systemd daemon to apply the changes.
  • Handles updater files first to prevent them from running during uninstallation.
packaging/installer/netdata-uninstaller.sh
Added functions to check for and manage systemd units in the updater script
  • Added a function to check if a systemd unit exists.
  • Modified the enable and disable functions to use the new existence check.
  • Starts and stops the netdata-updater.timer when enabling and disabling auto-updates, respectively.
packaging/installer/netdata-updater.sh
Modified the way systemd service directories are retrieved
  • Retrieves systemd unit paths using systemctl show.
  • Prioritizes writable lib paths over etc paths.
  • Provides fallback paths if systemctl show returns nothing.
packaging/installer/functions.sh
Renamed and re-prioritized certain API functions
  • Renamed streaming to netdata-streaming.
  • Renamed metrics-cardinality to netdata-metrics-cardinality.
  • Changed the priority of netdata-api-calls and netdata-metrics-cardinality.
src/web/api/functions/functions.c
Updated license file handling in Windows packaging
  • Copies the LICENSE file to /gpl-3.0.txt instead of downloading it.
  • Ensures the correct license file is included in the Windows package.
packaging/windows/package-windows.sh
Removed unnecessary file deletions in uninstaller
  • Removed redundant removal of netdata service and timer files.
  • Simplified the cleanup process.
packaging/installer/netdata-uninstaller.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants