Skip to content

Conversation

novel
Copy link

@novel novel commented May 21, 2025

Some systems, e.g. FreeBSD, place third-part software configuration files in /usr/local/etc instead of /etc.

Extend the install command to accept "etcprefix" option used for global configuration paths. By default it's "/", so it keeps the current behaviour unchanged.

Some systems, e.g. FreeBSD, place third-part software configuration
files in /usr/local/etc instead of /etc.

Extend the install command to accept "etcprefix" option used for global
configuration paths. By default it's "/", so it keeps the current
behaviour unchanged.

Signed-off-by: Roman Bogorodskiy <[email protected]>
@mr-avocado mr-avocado bot moved this to Review Requested in Default project May 21, 2025
@clebergnu clebergnu self-requested a review June 3, 2025 14:22
Copy link
Contributor

@clebergnu clebergnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @novel,

Thanks for raising and addressing this issue. Unfortunately, I see a few blockers in your implementation, but also a better way to solve this issue.

The path for the system-wide configuration files are defined in avocado/core/settings.py. We can either add a precedence of /usr/local if the systems you mention really do not use /etc for configuration, OR, we can implement a Settings plugin which contains a adjust_settings_path() implementation that adds usr/local to the path.

Let me know if you need help pursuing these options.

Thanks!

@novel
Copy link
Author

novel commented Jun 13, 2025

Hi @novel,

Thanks for raising and addressing this issue. Unfortunately, I see a few blockers in your implementation, but also a better way to solve this issue.

Thanks for the response!

The path for the system-wide configuration files are defined in avocado/core/settings.py. We can either add a precedence of /usr/local if the systems you mention really do not use /etc for configuration, OR, we can implement a Settings plugin which contains a adjust_settings_path() implementation that adds usr/local to the path.

FreeBSD does use /etc for configuration, but only for a base system configuration. Third party software configuration should be in /usr/local/etc. More details about that: https://man.freebsd.org/cgi/man.cgi?hier(7)

Regarding the change, I think I'm modifying avocado/core/settings.py already. I also wanted to make it configurable, so users could choose some prefix other than "/usr/local", that's why there is some additional layer over there.

Plugin is an interesting idea, I didn't think about doing it this way. Though, IIUC, that's of a runtime solution rather then install-time tunable. I think I don't have use cases right now to change that in runtime, not sure about others.

Let me know if you need help pursuing these options.

Thanks!

@clebergnu
Copy link
Contributor

Hi @novel,
Thanks for raising and addressing this issue. Unfortunately, I see a few blockers in your implementation, but also a better way to solve this issue.

Thanks for the response!

The path for the system-wide configuration files are defined in avocado/core/settings.py. We can either add a precedence of /usr/local if the systems you mention really do not use /etc for configuration, OR, we can implement a Settings plugin which contains a adjust_settings_path() implementation that adds usr/local to the path.

FreeBSD does use /etc for configuration, but only for a base system configuration. Third party software configuration should be in /usr/local/etc. More details about that: https://man.freebsd.org/cgi/man.cgi?hier(7)

That's enough to make Avocado (under FreeBSD at least) to look for configuration in /usr/local. I guess we can easily detect it using platform.system().

Regarding the change, I think I'm modifying avocado/core/settings.py already. I also wanted to make it configurable, so users could choose some prefix other than "/usr/local", that's why there is some additional layer over there.

Plugin is an interesting idea, I didn't think about doing it this way. Though, IIUC, that's of a runtime solution rather then install-time tunable. I think I don't have use cases right now to change that in runtime, not sure about others.

I'm not sure I got what you meant here. I'll write a patch with the /usr/local support in FreeBSD and then you can try it out and review it.

Thanks!

Let me know if you need help pursuing these options.
Thanks!

@clebergnu
Copy link
Contributor

@novel please take a look at #6171

@novel
Copy link
Author

novel commented Jun 13, 2025

I'm not sure I got what you meant here.

I mean, there are two approaches to address that:

  1. Every time during program execution we try to determine where to look up config files (that's what I call run time)
  2. Detect the path only once during install and save this value to reuse it for every execution (that's what I call install time).

Generally, both ways work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Review Requested
Development

Successfully merging this pull request may close these issues.

2 participants