Skip to content

Commit

Permalink
Fix system user/group name in logrotate.d/fluentd again
Browse files Browse the repository at this point in the history
This is follow-up of #592 to fix problem correctly.

fluent-package/tempaltes/etc/logrotate.d/fluentd is used
for deb and rpm, so it should support both of different
system user/group respectively.

Signed-off-by: Kentaro Hayashi <[email protected]>
  • Loading branch information
kenhys committed Oct 16, 2023
1 parent 7c239af commit 3ca44a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fluent-package/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,11 @@ class BuildTask
template_path(config)
end
dest = File.join(STAGING_DIR, config)
render_template(dest, src, template_params)
if File.readlines("/etc/os-release").any? { |entry| ["ID=debian", "ID=ubuntu"].include?(entry.chomp) }
render_template(dest, src, template_params({ pkg_type: "deb" }))
else
render_template(dest, src, template_params({ pkg_type: "rpm"}))
end
end
end

Expand Down
4 changes: 4 additions & 0 deletions fluent-package/templates/etc/logrotate.d/fluentd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
compress
delaycompress
notifempty
<% if pkg_type == 'deb' %>
create 640 _<%= service_name %> _<%= service_name %>
<% else %>
create 640 <%= service_name %> <%= service_name %>
<% end %>
sharedscripts
postrotate
pid=/var/run/<%= package_dir %>/<%= service_name %>.pid
Expand Down

0 comments on commit 3ca44a8

Please sign in to comment.