Skip to content

Commit

Permalink
FLUENT_PACKAGE_SERVICE_RESTART: make empty or other values as auto
Browse files Browse the repository at this point in the history
It should be easy to understand to be the default value if users
don't set FLUENT_PACKAGE_SERVICE_RESTART explicitly.

Signed-off-by: Daijiro Fukuda <[email protected]>
  • Loading branch information
daipom committed Dec 11, 2024
1 parent 038b770 commit b402f35
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion fluent-package/yum/fluent-package.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b402f35

Please sign in to comment.