Class: Puppet::Network::HTTP::API::Master::V3::Environments

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/network/http/api/master/v3/environments.rb

Instance Method Summary collapse

Constructor Details

#initialize(env_loader) ⇒ Environments


4
5
6
# File 'lib/puppet/network/http/api/master/v3/environments.rb', line 4

def initialize(env_loader)
  @env_loader = env_loader
end

Instance Method Details

#call(request, response) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/puppet/network/http/api/master/v3/environments.rb', line 8

def call(request, response)
  response.respond_with(200, "application/json", Puppet::Util::Json.dump({
    "search_paths" => @env_loader.search_paths,
    "environments" => Hash[@env_loader.list.collect do |env|
      [env.name, {
        "settings" => {
          "modulepath" => env.full_modulepath,
          "manifest" => env.manifest,
          "environment_timeout" => timeout(env),
          "config_version" => env.config_version || '',
        }
      }]
    end]
  }))
end