Sha256: 1499e95c2ac7838e311d1e30e1b7983905402bfd21c44e0d6a0ddd8499b910e1

Contents?: true

Size: 1.33 KB

Versions: 20

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true
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

20 entries across 20 versions & 1 rubygems

Version Path
puppet-8.3.0 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.3.0-x86-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.3.0-x64-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.3.0-universal-darwin lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.3.1 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.3.1-x86-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.3.1-x64-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.3.1-universal-darwin lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.2.0 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.2.0-x86-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.2.0-x64-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.2.0-universal-darwin lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.1.0 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.1.0-x86-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.1.0-x64-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.1.0-universal-darwin lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.0.1 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.0.1-x86-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.0.1-x64-mingw32 lib/puppet/network/http/api/server/v3/environments.rb
puppet-8.0.1-universal-darwin lib/puppet/network/http/api/server/v3/environments.rb