From 7e511e9885b1ac0eefd948658ea33d455f93935f Mon Sep 17 00:00:00 2001 From: Daijiro Fukuda Date: Wed, 11 Dec 2024 19:00:59 +0900 Subject: [PATCH] FLUENT_PACKAGE_SERVICE_RESTART: make empty or other values as auto (#767) --- .github/workflows/apt.yml | 9 ++++++--- .../apt/systemd-test/update-to-next-major-version.sh | 7 ++++++- .../templates/package-scripts/fluent-package/deb/prerm | 2 +- fluent-package/yum/fluent-package.spec.in | 2 +- .../yum/systemd-test/update-to-next-major-version.sh | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/apt.yml b/.github/workflows/apt.yml index 1c3da5ae..b7e57971 100644 --- a/.github/workflows/apt.yml +++ b/.github/workflows/apt.yml @@ -178,9 +178,12 @@ jobs: - "update-to-next-version-service-status.sh disabled active" - "update-to-next-version-service-status.sh disabled inactive" - "update-to-next-version-with-auto-and-manual.sh" - - "update-to-next-major-version.sh auto" - - "update-to-next-major-version.sh manual" - - "update-to-next-major-version.sh etc" + - "update-to-next-major-version.sh auto active" + - "update-to-next-major-version.sh auto inactive" + - "update-to-next-major-version.sh manual active" + - "update-to-next-major-version.sh manual inactive" + - "update-to-next-major-version.sh etc active" + - "update-to-next-major-version.sh etc inactive" - "update-without-data-lost.sh v5 v6" - "update-without-data-lost.sh v6 v5" include: diff --git a/fluent-package/apt/systemd-test/update-to-next-major-version.sh b/fluent-package/apt/systemd-test/update-to-next-major-version.sh index 9add0d32..cb6fb0f9 100755 --- a/fluent-package/apt/systemd-test/update-to-next-major-version.sh +++ b/fluent-package/apt/systemd-test/update-to-next-major-version.sh @@ -5,11 +5,16 @@ set -exu . $(dirname $0)/../commonvar.sh service_restart=$1 +status_before_update=$2 # active / inactive # Install the current sudo apt install -V -y \ /host/${distribution}/pool/${code_name}/${channel}/*/*/fluent-package_*_${architecture}.deb +if [ "$status_before_update" = inactive ]; then + sudo systemctl stop fluentd +fi + # Set FLUENT_PACKAGE_SERVICE_RESTART sed -i "s/=auto/=$service_restart/" /etc/default/fluentd @@ -35,7 +40,7 @@ if dpkg-query --show --showformat='${Version}' needrestart ; then fi # Test: Check whether plugin/gem were installed during upgrading -if [ "$service_restart" = auto ]; then +if [ "$service_restart" != manual ] && [ "$status_before_update" = active ]; then # plugin gem should be installed automatically /opt/fluent/bin/fluent-gem list | grep fluent-plugin-concat # Non fluent-plugin- prefix gem should not be installed automatically diff --git a/fluent-package/templates/package-scripts/fluent-package/deb/prerm b/fluent-package/templates/package-scripts/fluent-package/deb/prerm index 5e516d76..bd1c662b 100755 --- a/fluent-package/templates/package-scripts/fluent-package/deb/prerm +++ b/fluent-package/templates/package-scripts/fluent-package/deb/prerm @@ -40,7 +40,7 @@ leave_info_for_auto_restart_if_need() { . "/etc/default/<%= service_name %>" echo "FLUENT_PACKAGE_SERVICE_RESTART: $FLUENT_PACKAGE_SERVICE_RESTART" - if [ "$FLUENT_PACKAGE_SERVICE_RESTART" != auto ]; then + if [ "$FLUENT_PACKAGE_SERVICE_RESTART" = manual ]; then return fi diff --git a/fluent-package/yum/fluent-package.spec.in b/fluent-package/yum/fluent-package.spec.in index ba01eba2..a204f9cd 100644 --- a/fluent-package/yum/fluent-package.spec.in +++ b/fluent-package/yum/fluent-package.spec.in @@ -219,7 +219,7 @@ if [ $1 -eq 1 ]; then else . %{_sysconfdir}/sysconfig/@SERVICE_NAME@ echo "FLUENT_PACKAGE_SERVICE_RESTART: $FLUENT_PACKAGE_SERVICE_RESTART" - if [ "$FLUENT_PACKAGE_SERVICE_RESTART" = auto ]; then + if [ "$FLUENT_PACKAGE_SERVICE_RESTART" != manual ]; then # Present that FROM-side wants auto installing plugins and restarting. # Note: Wants to collect plugin-list here, but we need to do it in %pre (see comments in %pre). touch %{install_plugins} diff --git a/fluent-package/yum/systemd-test/update-to-next-major-version.sh b/fluent-package/yum/systemd-test/update-to-next-major-version.sh index 26390f41..f2a888de 100755 --- a/fluent-package/yum/systemd-test/update-to-next-major-version.sh +++ b/fluent-package/yum/systemd-test/update-to-next-major-version.sh @@ -27,7 +27,7 @@ package="/host/v6-test/${distribution}/${DISTRIBUTION_VERSION}/x86_64/Packages/f sudo $DNF install -y $package # Test: Check whether plugin/gem were installed during upgrading -if [ "$service_restart" = auto ] && [ "$status_before_update" = active ]; then +if [ "$service_restart" != manual ] && [ "$status_before_update" = active ]; then # plugin gem should be installed automatically /opt/fluent/bin/fluent-gem list | grep fluent-plugin-concat # Non fluent-plugin- prefix gem should not be installed automatically