Module: PuppetAgentMgr

Defined in:
lib/puppet_agent_mgr.rb,
lib/puppet_agent_mgr/common.rb,
lib/puppet_agent_mgr/version.rb

Defined Under Namespace

Modules: Common, V2, V3

Constant Summary collapse

VERSION =
"0.0.8"

Class Method Summary collapse

Class Method Details

.managerObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/puppet_agent_mgr.rb', line 4

def self.manager
  # puppet 2 requires this, 3 probably just ignores it
  $puppet_application_name = :agent

  require 'puppet'
  require 'json'

  if Puppet.version =~ /^(\d+)/
    case $1
      when "2"
        require 'puppet_agent_mgr/v2/manager'
        return PuppetAgentMgr::V2::Manager.new

      when "3"
        require 'puppet_agent_mgr/v3/manager'
        return PuppetAgentMgr::V3::Manager.new

      else
        raise "Cannot manage Puppet version %s" % $1
    end
  else
    raise "Cannot determine the Puppet major version"
  end
end