summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application/configurer.rb
blob: 378364430238f1374a718509b98bad25fd622c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'puppet/application'
require 'puppet/interface'

class Puppet::Application::Configurer < Puppet::Application
  should_parse_config
  run_mode :agent

  option("--debug","-d")
  option("--verbose","-v")

  def setup
    if options[:debug] or options[:verbose]
      Puppet::Util::Log.level = options[:debug] ? :debug : :info
    end

    Puppet::Util::Log.newdestination(:console)
  end

  def run_command
    report = Puppet::Interface.interface(:configurer).synchronize(Puppet[:certname])
    Puppet::Interface.interface(:report).submit(report)
  end
end