From 649cfc1260eb112190c9d4c31bb7edd2d895dca4 Mon Sep 17 00:00:00 2001 From: Kentaro Hayashi Date: Mon, 11 Nov 2024 16:12:35 +0900 Subject: [PATCH 1/3] ci deb: tweak downgrade test case Now, no need to unmask td-agent because transitional td-agent package was installed before. As unmask fluentd is not enough to cleanup td-agent inactive(dead) link so explicitly disable it to purge them. Signed-off-by: Kentaro Hayashi --- fluent-package/apt/systemd-test/downgrade-to-v4.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fluent-package/apt/systemd-test/downgrade-to-v4.sh b/fluent-package/apt/systemd-test/downgrade-to-v4.sh index 915675771..b950ba9df 100755 --- a/fluent-package/apt/systemd-test/downgrade-to-v4.sh +++ b/fluent-package/apt/systemd-test/downgrade-to-v4.sh @@ -24,7 +24,7 @@ sudo apt install -V -y \ sudo systemctl unmask td-agent # Even though removing fluent-package, log and .conf are kept. dpkg reports "rc fluent-package" and "rc td-agent" status. -sudo apt remove -y fluent-package +sudo apt remove -y fluent-package td-agent # fluentd.service is already masked (link to /dev/null), then remove it. sudo systemctl unmask fluentd From fe7c49e66e2a2646f70e2070fc170c030b80c6b4 Mon Sep 17 00:00:00 2001 From: Kentaro Hayashi Date: Tue, 12 Nov 2024 14:56:50 +0900 Subject: [PATCH 2/3] ci: show .service for debug Signed-off-by: Kentaro Hayashi --- .../apt/systemd-test/downgrade-to-v4.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fluent-package/apt/systemd-test/downgrade-to-v4.sh b/fluent-package/apt/systemd-test/downgrade-to-v4.sh index b950ba9df..e1bc050e1 100755 --- a/fluent-package/apt/systemd-test/downgrade-to-v4.sh +++ b/fluent-package/apt/systemd-test/downgrade-to-v4.sh @@ -1,5 +1,14 @@ #!/bin/bash +function debug_service_files() { + echo $1 + set +e + ls -la /usr/lib/systemd/system/ |grep -E 'td-agent|fluent-package' + ls -la /etc/systemd/system + ls -la /usr/lib/systemd/system/multi-user.target.wants/ + set -e +} + set -exu . $(dirname $0)/../commonvar.sh @@ -26,9 +35,13 @@ sudo systemctl unmask td-agent # Even though removing fluent-package, log and .conf are kept. dpkg reports "rc fluent-package" and "rc td-agent" status. sudo apt remove -y fluent-package td-agent +debug_service_files "DEBUG: after remove fluent-package td-agent" + # fluentd.service is already masked (link to /dev/null), then remove it. sudo systemctl unmask fluentd +debug_service_files "DEBUG: after unmask fluentd" + # Drop symbolic links and recreate real directory. sudo rm -f /var/log/td-agent sudo rm -f /etc/td-agent @@ -45,6 +58,8 @@ sudo chown td-agent:td-agent /etc/td-agent sudo mv /etc/fluent/td-agent.conf /etc/td-agent/ curl -fsSL https://toolbelt.treasuredata.com/sh/install-${distribution}-${code_name}-td-agent4.sh | sh +debug_service_files "DEBUG: after downgrade" + # Test: service status (! systemctl status --no-pager fluentd) (systemctl status --no-pager td-agent) From dbc21b09d9bfe5050d407a512dd9b0c14f7b92fe Mon Sep 17 00:00:00 2001 From: Kentaro Hayashi Date: Tue, 12 Nov 2024 18:52:37 +0900 Subject: [PATCH 3/3] Try to fix --- fluent-package/apt/systemd-test/downgrade-to-v4.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fluent-package/apt/systemd-test/downgrade-to-v4.sh b/fluent-package/apt/systemd-test/downgrade-to-v4.sh index e1bc050e1..8d5d10cfd 100755 --- a/fluent-package/apt/systemd-test/downgrade-to-v4.sh +++ b/fluent-package/apt/systemd-test/downgrade-to-v4.sh @@ -29,8 +29,9 @@ sudo apt install -V -y \ /host/${distribution}/pool/${code_name}/${channel}/*/*/fluent-package_*_${architecture}.deb \ /host/${distribution}/pool/${code_name}/${channel}/*/*/td-agent_*_all.deb -# td-agent.service is already masked (link to /dev/null), and remove td-agent.service alias not to conflict with v4 -sudo systemctl unmask td-agent +sudo systemctl is-active fluentd +sudo systemctl is-active td-agent +sudo systemctl stop fluentd # Even though removing fluent-package, log and .conf are kept. dpkg reports "rc fluent-package" and "rc td-agent" status. sudo apt remove -y fluent-package td-agent @@ -39,6 +40,8 @@ debug_service_files "DEBUG: after remove fluent-package td-agent" # fluentd.service is already masked (link to /dev/null), then remove it. sudo systemctl unmask fluentd +# purge inacive (dead) symbolic links +sudo systemctl disable td-agent debug_service_files "DEBUG: after unmask fluentd" @@ -60,6 +63,9 @@ curl -fsSL https://toolbelt.treasuredata.com/sh/install-${distribution}-${code_n debug_service_files "DEBUG: after downgrade" +# re-create symlink to point service file again +sudo systemctl enable td-agent --now + # Test: service status (! systemctl status --no-pager fluentd) (systemctl status --no-pager td-agent)