Add ability to override default system confdir and vardir#2236
Add ability to override default system confdir and vardir#2236jeffmccune wants to merge 1 commit intopuppetlabs:masterfrom
Conversation
|
CLA signed by all contributors. |
This is just a work in progress of where I left off. This branch will be rebased. Where I left off was using the new API that I hope will be merged in as puppetlabs/puppet#2236 In addition, we'll need to implement the fallback behavior of modifying run_mode.rb directly which I consider the "hacky" solution, but it's necessary for versions of Puppet that are released today without the public relocation API.
Without this patch it's difficult to change the behavior of determining the default confdir and vardir settings. This is a problem because it's difficult to relocate Puppet which is necessary in certain cases, such as Puppet Enterprise and our Ops team using /etc/operations/puppet as the default confdir. This patch exposes a public API to allow third party tools to easily determine the file to write to override the default confdir and vardir. The API method is Puppet::Util::RunMode.override_path(type) where type is either "confdir" or "vardir" An anticipated use case is that a simple rubygems plugin gem could register a post_install hook to write an override file which will relocate puppet. A path relative to the gem source file has been chosen to facilitate multiple copies of the Puppet library being installed and relocated to their own isolated paths or gemset.
|
If it might help, here's the Gem that I've written that takes advantage of this API in order to install the official, released puppet gem and have it automatically relocated. This gem demonstrates the approach required without this patch applied, directly patching |
|
After a bit of discussion during the PR triage, a long discussion and IRC, and @adrienthebo talking to some others (@haus, I believe), the decision is that we aren't going to take this change as is. The crux of the problem comes down to the desire to use released gems, supposedly unmodified, but configured to work differently at install time, to remove any need to specify the confdir and vardir, yet use the non-default confdir and vardir. This is a very specific set of requirements, which is not something that we want to maintain. If we drop the requirement to use the released gems, then there is an approach that I would be happy to maintain: introduce a build step into how puppet gets packaged and allow that to control the default confdir and vardir of that build of puppet. |
|
The purpose of the change is to enable those who are currently The alternatives proposed don't address the primary use case and as Go ahead and close this pull request unless there's some way we can |
|
@zaphod42 One of the questions you asked last week in IRC was what other systems are out there that override defaults like this. At the time I didn't provide anything constructive or useful. If it helps, and is additional information, there are two systems that served as inspiration for this change. First, Java .properties files were the inspiration for placing the .override file in this change along side the code itself instead of a well-known and absolute path. It's my understanding that .properties files are commonly used to override the default behavior of the code itself. Second, there's the alternatives system in some Linux distributions. This system allows a system administrator or end user to override the default behavior of the system and replace it with an alternative. Alternatives uses symlinks, however, which I didn't think were well-suited to this use case since symlinks don't behave consistently on all of our supported platforms. This led me to select reading the first line of a plain text files as the basis for the implementation. It's similar to a symbolic link, but behaves consistently across all of our supported platforms. In the past week have there been any ideas that have come up that would allow us to accomplish something like this with the released puppet gem? On my end, the only thing I've been able to come up with is to eliminate the filesystem altogether and instead try to load some gem library and, if successful, use an instance method from that library to set the default system confdir and vardir. |
|
@jeffmccune anything that causes defaults to come from configuration files is off the table from my perspective, it just causes too much complexity at the point of fallbacks where we want nothing to go wrong. @adrienthebo talk with @haus and Matt and came to the conclusion that making this a build time configuration and having packages that are built to have puppet in a different location would work well for them. Thank you for talking with us about this, unfortunately we just don't see eye to eye on if this is the right direction to take to solve the underlying problem and also take the codebase in the direction that I'd like to see. I'm open to changes that introduce a build step and make the defaults configurable at build/packaging time. |
|
On Jan 29, 2014, at 6:56 PM, Andrew Parker notifications@github.com wrote: @jeffmccune https://github.com/jeffmccune anything that causes defaults Thanks for the response. If I'm understanding your position I take it you'd Is that correct? Just trying to figure out if it'd be worth my time trying again with the -Jeff |
|
On Thu, Jan 30, 2014 at 4:00 AM, Jeff McCune notifications@github.comwrote:
Andrew Parker Join us at PuppetConf 2014, September 23-24 in San Francisco |
OK. I may try once more just for my own exercise, but please know I'm I'll try to keep it as simple as possible since complexity is the main concern.
Not really, I mean, I'm really not trying to be deliberately difficult It's really not that big of a deal, so I'm fine just keeping these |
Without this patch it's difficult to change the behavior of determining the
default confdir and vardir settings. This is a problem because it's difficult
to relocate Puppet which is necessary in certain cases, such as Puppet
Enterprise and our Ops team using /etc/operations/puppet as the default
confdir.
This patch exposes a public API to allow third party tools to easily determine
the file to write to override the default confdir and vardir. The API method is
Puppet::Util::RunMode.override_path(type) where type is either "confdir" or
"vardir" An anticipated use case is that a simple rubygems plugin gem could
register a post_install hook to write an override file which will relocate
puppet.
A path relative to the gem source file has been chosen to facilitate multiple
copies of the Puppet library being installed and relocated to their own
isolated paths or gemset.