Class: PEClient::Resource::PuppetAdminV1

Inherits:
BaseWithPort show all
Defined in:
lib/pe_client/resources/puppet_admin.v1.rb

Overview

Deleting environment caches created by a primary server. Deleting the Puppet Server pool of JRuby instances.

Constant Summary collapse

BASE_PATH =

The base path for Puppet Admin API v1 endpoints.

"/puppet-admin-api/v1"
PORT =

Default Puppet Admin API Port

8140

Instance Method Summary collapse

Methods inherited from BaseWithPort

#initialize

Constructor Details

This class inherits a constructor from PEClient::Resource::BaseWithPort

Instance Method Details

#environment_cache(environment: nil) ⇒ Hash

When using directory environments, Puppet Server caches the data it loads from disk for each environment. This endpoint is for clearing this cache

Parameters:

  • (defaults to: nil)

    Set to the name of a specific Puppet environment. If this parameter is provided, only the specified environment will be flushed from the cache, as opposed to all environments.

Returns:

  • If successful, returns an empty JSON object.



40
41
42
# File 'lib/pe_client/resources/puppet_admin.v1.rb', line 40

def environment_cache(environment: nil)
  @client.delete "#{BASE_PATH}/environment-cache", params: {environment:}.compact
end

#jruby_poolHash

Puppet Server contains a pool of JRuby instances. This will remove all of the existing JRuby interpreters from the pool, allowing the memory occupied by these interpreters to be reclaimed by the JVM’s garbage collector. The pool will then be refilled with new JRuby instances, each of which will load the latest Ruby code and related resources from disk.

Returns:

  • If successful, returns an empty JSON object.



49
50
51
# File 'lib/pe_client/resources/puppet_admin.v1.rb', line 49

def jruby_pool
  @client.delete "#{BASE_PATH}/jruby-pool"
end

#jruby_thread_dumpHash

Retrieve a Ruby thread dump for each JRuby instance registered to the pool. The thread dump provides a backtrace through the Ruby code that each instance is executing and is useful for diagnosing instances that have stalled or are otherwise unresponsive.

Returns:



57
58
59
# File 'lib/pe_client/resources/puppet_admin.v1.rb', line 57

def jruby_thread_dump
  @client.get "#{BASE_PATH}/jruby-pool/thread-dump"
end