-
Notifications
You must be signed in to change notification settings - Fork 31
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
Fix config load when HOME="/" #2173
base: main
Are you sure you want to change the base?
Conversation
@@ -410,7 +410,7 @@ func (c *Config) UnParsedOptions() map[string]string { | |||
func (c *Config) dotdDir() string { | |||
if !forceDotParse { | |||
home, err := iu.HomeDir() | |||
if err == nil { | |||
if err == nil && home != "/" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like quite a big special case here that just doesnt seem like it belong. Should we fix FreeBSD rc scripts instead @smortex ?
@robert-fraczek, I am not sure to follow, and I can't reproduce your problem. Are you saying that the home directory of the root user is the root of the filesystem, i.e. Forcing # HOME=/ choria server run --config /usr/local/etc/choria/server.conf Maybe you can describe the whole configuration files you have because my setup is probably quite different than yours? |
Some additional comments and obervations:
choria trying to connect to "puppet" server which doesnt exist
And everything is ok, broker url is taken from:
|
953e3d9
to
1829014
Compare
Thank you for the details, I think I better understand what is going on, and as you say, I think it is the combination of multiple issues that break your use case. I have no issue with my configuration where I only rely on About
|
The problem is we cant totally ignore /etc/.../plugins.d as many of the module plugins set their settings there and some are even application settings. Thus if we skip them we'd skip important things. This led to undefined behaviour simply by trying to override some settings in your home dir. Essentially think of /etc/.../plugins.d being puppet managed settings that should be enabled for the system to work. But puppet wouldnt manage them anywhere else so the current behaviour kind of achieves that. The behaviour of the choria.conf you added @smortex is much better and more useful, but we're kind of stuck with this mess around the other files. |
Some plugins need to load configuration that is managed system-wide by Puppet even when the user is using their own configuration file. Regardless of the configuration file loaded (system one or user one), we want to load these plugins configuration from the system. We previously inferred the plugins configuration directory relatively to the rest of the configuration, but ignored it if it was located in the user HOME directory. This was not correct, and even caused more trouble when the HOME environment variable was '/' as it is commonly on some systems for services, because plugins configuration was never loaded on these systems. Fix this by detecting the location of the system configuration and unconditionally loading plugins configuration from this directory.
I struggled with go to try to implement what I understand to be the correct behavior in #2174: determine the system-wide location for choria config, and use this to load plugins regardless of the configuration being used. |
There is an issue i found on FreeBSD systems with starting choria-server via "service choria-server start" command causing global configuration doesn`t load. Same problem occur after OS reboot. Moreover i discover that starting via /usr/local/etc/rc.d/choria-server work properly.
Problem is with env HOME set to "/" when starting with service command ( rc.d set HOME="/root" ).
There is an issue with logic discovering local "home" configuration that prevent global configs to load.
Matching $HOME as prefix to config path when $HOME is "/" will always be true preventing to load global configs - as a quick fix i propose to make an exception for that.