-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rpm: take over enabled state of systemd service from v4 (#613)
In the previous versions, the enabled service status of td-agent was not migrated. This commit try to take over existing td-agent service status. Note that if systemctl enable fluentd is executed in %post section, it was reverted in td-agent's %preun scriptlet. So it is enabled in %posttrans explicitly. Closes: #610
- Loading branch information
Showing
4 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
%define v4migration /tmp/@PACKAGE_DIR@/.v4migration | ||
%define v4migration_with_restart /tmp/@PACKAGE_DIR@/.v4migration_with_restart | ||
%define v4migration_old_rotate_config_saved /tmp/@PACKAGE_DIR@/.old_rotate_config | ||
%define v4migration_enabled_service /tmp/@PACKAGE_DIR@/.v4migration_enabled_service | ||
|
||
%global __provides_exclude_from ^/opt/%{name}/.*\\.so.* | ||
%global __requires_exclude libjemalloc.*|libruby.*|/opt/%{name}/.* | ||
|
@@ -207,6 +208,11 @@ if [ $1 -eq 1 ]; then | |
ln -sf /etc/@PACKAGE_DIR@/@[email protected] /etc/@PACKAGE_DIR@/@[email protected] | ||
fi | ||
fi | ||
if systemctl is-enabled @COMPAT_SERVICE_NAME@; then | ||
# It is not enough to systemctl enable fluentd here for taking over enabled service status | ||
# because td-agent %preun disables td-agent so fluentd is also disabled. | ||
touch %{v4migration_enabled_service} | ||
fi | ||
if systemctl is-active @COMPAT_SERVICE_NAME@; then | ||
if getent passwd @COMPAT_SERVICE_NAME@ >/dev/null; then | ||
if ! getent passwd @SERVICE_NAME@ >/dev/null; then | ||
|
@@ -314,6 +320,12 @@ if [ -f %{v4migration} ]; then | |
echo "Restores logrotate config from backup" | ||
mv -f %{v4migration_old_rotate_config_saved} /etc/logrotate.d/@COMPAT_SERVICE_NAME@ | ||
fi | ||
if [ -f %{v4migration_enabled_service} ]; then | ||
# Explicitly enable service here not to be disabled during td-agent's %preun scriptlet. | ||
echo "@COMPAT_SERVICE_NAME@ was enabled. Take over enabled service status ..." | ||
systemctl enable @SERVICE_NAME@ | ||
rm -f %{v4migration_enabled_service} | ||
fi | ||
rm -f %{v4migration} | ||
if [ -f %{v4migration_with_restart} ]; then | ||
# When upgrading from v4, td-agent.service will be removed | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters