Issue #17783 has been updated by Andrew  Parker.

Tracker changed from Bug to Feature
Status changed from Unreviewed to Accepted

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:

<pre>

config = Puppet::Configuration.new('/etc/puppet/puppet.conf', 
Puppet.setting_definitions)
paths = config.collect(&:modulepath)

</pre>

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).
----------------------------------------
Feature #17783: No public interface to reinitialize all settings to find new 
environments
https://projects.puppetlabs.com/issues/17783#change-77408

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