system_config: add umask option to <system> directive#5390
Conversation
Signed-off-by: somaz <genius5711@gmail.com>
|
It is ideal that not only checking serverengine layer, but also actual generated buffer permissions for example. could you afford to add such a test case? |
…ermissions Signed-off-by: somaz <genius5711@gmail.com>
|
Added an end-to-end test in One thing worth noting: the buffer files only pick up the umask in |
Watson1978
left a comment
There was a problem hiding this comment.
Thanks for seeing this through, and for adding the buffer-permission test in response to the review.
The implementation is nicely minimal — reusing the existing chumask path (now that #4836 fixed it reaching ServerEngine) and keeping umask as a string so it flows through the same to_i(8) handling is the right call. The command-line precedence via !@cl_opt.key?(:chumask) is correct too, since cmd_opts only gains :chumask when --umask is actually passed.
For future readers, it's worth being explicit that <system> umask takes effect in exactly the same modes as the existing --umask option:
--no-supervisor(standalone): applied — Fluentd callsFile.umaskdirectly in the worker.- Supervised +
--daemon(daemonize, e.g. fluent-package): applied — ServerEngine sets the umask before spawning workers, so worker-created files inherit it. - Supervised without
--daemon(foreground): not applied to worker-created files — ServerEngine's non-daemonize path never callsFile.umask, and Fluentd doesn't setworker_chumask.
So the common packaged deployment (--daemon) does honor it; only the foreground-supervisor case is uncovered. That's existing --umask behavior rather than anything this PR changes, so it's not a blocker.
For the foreground-supervisor gap, let's track it in a separate follow-up issue rather than widening this PR — keeping this one scoped to "the config-file equivalent of --umask" is cleanest, and matches what you already suggested.
For the docs follow-up, it'd help to spell out which modes the option takes effect in, so users on a foreground supervisor don't expect it to change buffer file permissions.
Thanks.
|
@kenhys I'm planning to approve this. The umask applicability matches the existing |
/ --umask` is not applied to worker-created files under a foreground supervisor
#5435
I'll second that decision. |
Which issue(s) this PR fixes: Fixes #4816
What this PR does / why we need it:
Adds a
umaskoption to the<system>directive so the process umask can beset from the config file. Previously this required the
--umaskcommand lineoption, which is inconvenient for services and container images.
It reuses the existing chumask handling:
<system> umasksets the same valuethat
--umaskdoes, and the command line option takes precedence when both aregiven. Both supervised and
--no-supervisormodes honor it.Tests: added a config round-trip case and a supervisor test asserting the value
reaches ServerEngine, including command-line precedence.
Docs Changes:
fluent/fluentd-docs-gitbook#625
Release Note:
Add
umaskoption to the<system>directive.