On 22/10/12 19:25, R.I.Pienaar wrote:
> hello,
>
> I need to get Puppet to read its config file and specifically use the
> settings like an agent would.
>
> I need this for 2.7 and 3.0
>
> In trying to figure this out for 3.0 I have the following:
>
> require 'puppet'
> require 'puppet/util/run_mode'
> Puppet.settings.preferred_run_mode = :agent
I think you might need a:
Puppet.settings.use :main, :agent
so that your code loads the correct sections from the settings file.
> run_mode = Puppet::Util::RunMode[ Puppet.settings.preferred_run_mode ]
>
> Puppet.settings.initialize_app_defaults(Puppet::Settings.app_defaults_for_run_mode(run_mode))
>
> At this point Puppet[:pidfile] is /var/lib/puppet/run/agent.pid but when I do:
It might be the default, which for $agent_pid is $statedir/agent.pid.
But the default $statedir is $vardir/state, so that's not quite yet that...
> # puppet agent --configprint pidfile
>
> I get /var/run/puppet/agent.pid
What is configured in your puppet.conf?
> What is the correct way for both 2.7 and 3.0 to initialize the settings
> and to be sure I am seeing agent settings?
>
> It's OK if the way is completely different between versions, I have a way to
> handle that.
I don't think there are such differences between 2.7/3.0, so it's
possible the same code could work for both versions.
--
Brice Figureau
My Blog: http://www.masterzen.fr/
--
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.