Issue #17783 has been updated by Dominic Cleal.

Andrew  Parker wrote:
> Are you looking for a way to read the files on disk, or do you need to 
> include command line parameter parsing in this as well? From the description 
> that is given, it sounds like you are just looking for something that can 
> read the puppet configuration files on demand.
> 
> Maybe something like:

Just looking for the disk reading part as you say.  We do pass in two command 
line parameters today for Puppet 3.0, but only to initialise the disk reading - 
the Puppet config file if the user specified it (else we want to use Puppet's 
default) and the run_mode set to `master`.

The latter is important today, because we're trying to read settings in the 
context of the puppetmaster.

> That could then be re-run periodically and without problem if it was self 
> contained and didn't rely on any global state, which is the big problem with 
> the current settings system (it is essentially one big global hash).

It's that big hash we're currently jumping in and reading privately I think to 
extract the environments information, while just querying `Puppet[:foo]` for 
other settings we're interested in.  So yes, this sounds spot on.
----------------------------------------
Feature #17783: No public interface to reinitialize all settings to find new 
environments
https://projects.puppetlabs.com/issues/17783#change-77417

Author: Dominic Cleal
Status: Accepted
Priority: Normal
Assignee: 
Category: settings
Target version: 
Affected Puppet version: 3.0.0
Keywords: settings interfaces
Branch: 


Foreman's proxy calls the `Puppet::Settings` class to learn of all environments 
and their settings (modulepaths) that a puppet master is configured to serve.  
Since the proxy is a daemon, it needs to be able to pick up changes made to 
puppet.conf without restarting.

With Puppet 2.x, this would look like:

    Puppet.clear
    Puppet.parse_config

With Puppet 3.0, we call this method indicating the run_mode we're interested 
in (Foreman isn't a face, it's just enquiring about the behaviour of the 
puppetmaster):

    Puppet.settings.initialize_global_settings(["--config=/path", '--run_mode' 
'master'])

This can only be called once, since `@global_defaults_initialized` is set in 
Puppet::Settings and it throws an error if called twice.  The `clear` method 
doesn't reset global or app defaults (by er, default) and the only method that 
does is the private `clear_everything_for_tests` method.  Calling this private 
method instead of `clear`, then calling `initialize_global_settings` again 
allows us to pick up on environment changes in puppet.conf successfully.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to