Sha256: 4783d4ad86323cde1ecb4194e36f65864406591508af660940aa60ac2b7a735d

Contents?: true

Size: 1.31 KB

Versions: 120

Compression:

Stored size: 1.31 KB

Contents

require_relative '../../../../../../puppet/util/json'

module Puppet
  module Network
    module HTTP
      class API
        module Server
          class V3
            class Environments

              def initialize(env_loader)
                @env_loader = env_loader
              end

              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

              private

              def timeout(env)
                ttl = @env_loader.get_conf(env.name).environment_timeout
                if ttl == Float::INFINITY
                  "unlimited"
                else
                  ttl
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

120 entries across 120 versions & 1 rubygems

Version Path
puppet-7.34.0 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.34.0-x86-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.34.0-x64-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.34.0-universal-darwin lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.33.0 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.33.0-x86-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.33.0-x64-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.33.0-universal-darwin lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.32.1 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.32.1-x86-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.32.1-x64-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.32.1-universal-darwin lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.31.0 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.31.0-x86-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.31.0-x64-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.31.0-universal-darwin lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.30.0 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.30.0-x86-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.30.0-x64-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-7.30.0-universal-darwin lib/puppet/network/http/api/server/v3/environments.rb