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

Debug ci fix downgrade #12

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions fluent-package/apt/systemd-test/downgrade-to-v4.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -20,14 +29,21 @@ 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
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
# purge inacive (dead) symbolic links
sudo systemctl disable td-agent

debug_service_files "DEBUG: after unmask fluentd"

# Drop symbolic links and recreate real directory.
sudo rm -f /var/log/td-agent
Expand All @@ -45,6 +61,11 @@ 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"

# 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)
Expand Down
Loading