> > The real problem here is that run_mode was a broken model when I did it, > and the reification of it didn't sufficiently fix it. >
I agree with this statement completely. > require that applications set it, in the same way that they set things like > terminus_class. This makes everything simple and obvious, and easy to > change. It probably even makes sense to have a DSL-style hook in the > Application class: > > Puppet::Application.new(:mystuff) do > runs_as :master > ... > end > turns out we already have a syntax like this, but it's a declaration of the mapping from application to run_mode rather than setting a mutable value IMO, the main fix we need to do is to allow run_mode to be directly set > The reason I made it read-only was that there wasn't a mechanism to change the defaults of other settings when the run_mode changed - if I had already calculated the default value for (for example) $vardir, and I changed the run_mode, the $vardir default wouldn't get updated - which would put the unsuspecting developer into a world of hurt. As to combining the settings into one and having the conditional in > defaults.rb, every conditional in defaults.rb is a *huge* pain to maintain > going forward, and effectively means it's very difficult to change in > puppet.conf or equivalent. This is currently true. Looking at defaults.rb, almost every non-constant (conditional or otherwise calculated) default is trying to work-around the problem that we don't model different defaults for different run_modes. It seems crazy to me that in puppet.conf you could trivially write: [master] yamldir = "$vardir/yaml" [agent] yamldir = "$vardir/client_yaml" but we have no way of safely doing that in defaults.rb . I've opened a ticket ( http://projects.puppetlabs.com/issues/4784 ) to allow different default settings values for different run_modes. I suspect that it would be no more difficult to implement than any other small change to Puppet::Util::Settings would be. ~Jesse -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
