On Wed, Sep 4, 2013 at 3:13 PM, John Julien <[email protected]> wrote:
> I would like to check if Puppet is in noop mode or administratively
> disabled from inside a ruby script. I am having trouble getting the noop
> setting to read in properly when under the [agent] section of the config
> file. My puppet.conf has noop = true under the agent section and puppet is
> disabled via puppet agent --disable.
>
> My script outputs:
> *agent : noop : false
> Puppet is disabled
> *
> puppet config --mode agent print noop
> outputs: true
>
> Can anyone offer any guidance? Should I just use shell and parse the
> output? Here's my script:
>
> #!/opt/puppet/bin/ruby
>
> require 'puppet'
>
> setting = Puppet.settings.setting(:noop)
> puts "#{setting.section} : #{setting.name} : #{setting.value}"
>
> app = Puppet::Application::Agent.new()
> app.preinit
> Puppet[:daemonize] = false
> app.setup
> if app.agent.disabled?
> puts "Puppet is disabled"
> end
>
Try adding a call to Puppet.initialize_settings right after requiring
puppet. I think right now you are just getting the default because nothing
is causing puppet to read the config file.
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-dev.
For more options, visit https://groups.google.com/groups/opt_out.