Liking cljdoc? Tell your friends :D
Clojure only.

puppetlabs.services.master.master-core


add-metric-ids-to-http-client-metrics-list!clj

(add-metric-ids-to-http-client-metrics-list! metric-id-atom metric-ids-to-add)

Inputs: [metric-id-atom :- MetricIdsForStatus metric-ids-to-add :- [[schema/Str]]]

Inputs: [metric-id-atom :- MetricIdsForStatus metric-ids-to-add :- [[schema/Str]]]
sourceraw docstring

add-path-to-file-entryclj

(add-path-to-file-entry file-detail file-name)

Inputs: [file-detail :- Map file-name :- schema/Str] Returns: Map

Convert the value for a manifest file entry into an appropriate map for use in serializing an environment_classes response to JSON.

Inputs: [file-detail :- Map file-name :- schema/Str]
Returns: Map

Convert the value for a manifest file entry into an appropriate map for
use in serializing an environment_classes response to JSON.
sourceraw docstring

all-plans-fnclj

(all-plans-fn jruby-service)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)] Returns: IFn

Middleware function for constructing a Ring response from an incoming request for plans information.

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)]
Returns: IFn

Middleware function for constructing a Ring response from an incoming
request for plans information.
sourceraw docstring

all-plans-handlerclj

(all-plans-handler jruby-service)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)] Returns: IFn

Handler for processing an incoming all_plans Ring request

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)]
Returns: IFn

Handler for processing an incoming all_plans Ring request
sourceraw docstring

all-plans-response!clj

(all-plans-response! info-from-jruby environment)

Inputs: [info-from-jruby :- [#:schema{Any schema/Any}] environment :- schema/Str] Returns: ringutils/RingResponse

Process the info, returning a Ring response to be propagated back up to the caller of the endpoint. Returns environment as a list of objects for an eventual future in which tasks for all environments can be requested, and a given task will list all the environments it is found in.

Inputs: [info-from-jruby :- [#:schema{Any schema/Any}] environment :- schema/Str]
Returns: ringutils/RingResponse

Process the info, returning a Ring response to be propagated back up to the
caller of the endpoint.
Returns environment as a list of objects for an eventual future in which
tasks for all environments can be requested, and a given task will list all
the environments it is found in.
sourceraw docstring

all-tasks-fnclj

(all-tasks-fn jruby-service)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)] Returns: IFn

Middleware function for constructing a Ring response from an incoming request for tasks information.

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)]
Returns: IFn

Middleware function for constructing a Ring response from an incoming
request for tasks information.
sourceraw docstring

all-tasks-handlerclj

(all-tasks-handler jruby-service)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)] Returns: IFn

Handler for processing an incoming all_tasks Ring request

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)]
Returns: IFn

Handler for processing an incoming all_tasks Ring request
sourceraw docstring

all-tasks-response!clj

(all-tasks-response! info-from-jruby environment)

Inputs: [info-from-jruby :- [#:schema{Any schema/Any}] environment :- schema/Str] Returns: ringutils/RingResponse

Process the info, returning a Ring response to be propagated back up to the caller of the endpoint. Returns environment as a list of objects for an eventual future in which tasks for all environments can be requested, and a given task will list all the environments it is found in.

Inputs: [info-from-jruby :- [#:schema{Any schema/Any}] environment :- schema/Str]
Returns: ringutils/RingResponse

Process the info, returning a Ring response to be propagated back up to the
caller of the endpoint.
Returns environment as a list of objects for an eventual future in which
tasks for all environments can be requested, and a given task will list all
the environments it is found in.
sourceraw docstring

CatalogRequestV4clj

source

class-info-from-jruby->class-info-for-jsonclj

(class-info-from-jruby->class-info-for-json info-from-jruby environment)

Inputs: [info-from-jruby :- Map environment :- schema/Str] Returns: EnvironmentClassesInfo

Convert a class info map received from the jruby service into an appropriate map for use in serializing an environment_classes response to JSON. The map that this function returns should be 'sorted' by key - both at the top-level and within any nested map - so that it will consistently serialize to the exact same content. For this reason, this function and the functions that this function calls use the sorted-map and sort-nested-java-maps helper functions when constructing / translating maps.

Inputs: [info-from-jruby :- Map environment :- schema/Str]
Returns: EnvironmentClassesInfo

Convert a class info map received from the jruby service into an
appropriate map for use in serializing an environment_classes response to
JSON.  The map that this function returns should be 'sorted' by key - both
at the top-level and within any nested map - so that it will consistently
serialize to the exact same content.  For this reason, this function and
the functions that this function calls use the `sorted-map` and
`sort-nested-java-maps` helper functions when constructing / translating
maps.
sourceraw docstring

compile-fnclj

(compile-fn jruby-service current-code-id-fn boltlib-path)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) current-code-id-fn :- IFn boltlib-path :- (schema/maybe [schema/Str])] Returns: IFn

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) current-code-id-fn :- IFn boltlib-path :- (schema/maybe [schema/Str])]
Returns: IFn
sourceraw docstring

compile-handlerclj

(compile-handler jruby-service
                 wrap-with-jruby-queue-limit
                 current-code-id-fn
                 boltlib-path)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) wrap-with-jruby-queue-limit :- IFn current-code-id-fn :- IFn boltlib-path :- (schema/maybe [schema/Str])] Returns: IFn

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) wrap-with-jruby-queue-limit :- IFn current-code-id-fn :- IFn boltlib-path :- (schema/maybe [schema/Str])]
Returns: IFn
sourceraw docstring

CompileRequestclj

source

construct-root-routesclj

(construct-root-routes puppet-version
                       jruby-service
                       get-code-content
                       current-code-id
                       handle-request
                       wrap-with-authorization-check
                       wrap-with-jruby-queue-limit
                       environment-class-cache-enabled
                       boltlib-path
                       certname)

Inputs: [puppet-version :- schema/Str jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) get-code-content :- IFn current-code-id :- IFn handle-request :- IFn wrap-with-authorization-check :- IFn wrap-with-jruby-queue-limit :- IFn environment-class-cache-enabled :- schema/Bool boltlib-path :- (schema/maybe [schema/Str]) certname :- schema/Str] Returns: bidi-schema/RoutePair

Creates a wrapped ruby request handler and a clojure request handler, then uses those to create all of the web routes for the master.

Inputs: [puppet-version :- schema/Str jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) get-code-content :- IFn current-code-id :- IFn handle-request :- IFn wrap-with-authorization-check :- IFn wrap-with-jruby-queue-limit :- IFn environment-class-cache-enabled :- schema/Bool boltlib-path :- (schema/maybe [schema/Str]) certname :- schema/Str]
Returns: bidi-schema/RoutePair

Creates a wrapped ruby request handler and a clojure request handler,
then uses those to create all of the web routes for the master.
sourceraw docstring

create-cacheable-info-handler-with-middlewareclj

(create-cacheable-info-handler-with-middleware info-fn
                                               jruby-service
                                               cache-enabled)

Inputs: [info-fn :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) cache-enabled :- schema/Bool] Returns: IFn

Creates a cacheable info handler and wraps it in appropriate middleware.

Inputs: [info-fn :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) cache-enabled :- schema/Bool]
Returns: IFn

Creates a cacheable info handler and wraps it in appropriate middleware.
sourceraw docstring

describe-task-fileclj

(describe-task-file get-code-content env-name code-id file-data)
source

environment-module-handlerclj

(environment-module-handler jruby-service)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)] Returns: IFn

Handler for processing an incoming environment_modules Ring request

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)]
Returns: IFn

Handler for processing an incoming environment_modules Ring request
sourceraw docstring

environment-module-info-fnclj

(environment-module-info-fn jruby-service)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)] Returns: IFn

Middleware function for constructing a Ring response from an incoming request for environment_modules information.

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)]
Returns: IFn

Middleware function for constructing a Ring response from an incoming
request for environment_modules information.
sourceraw docstring

environment-module-response!clj

(environment-module-response! info-from-jruby)
(environment-module-response! info-from-jruby environment)

Inputs: ([info-from-jruby :- Map] [info-from-jruby :- List environment :- schema/Str]) Returns: ringutils/RingResponse

Process the environment module information, returning a ring response to be propagated back up to the caller of the environment_modules endpoint.

Inputs: ([info-from-jruby :- Map] [info-from-jruby :- List environment :- schema/Str])
Returns: ringutils/RingResponse

Process the environment module information, returning a ring response to be
propagated back up to the caller of the environment_modules endpoint.
sourceraw docstring

environment-not-foundclj

(environment-not-found environment)

Inputs: [environment :- schema/Str] Returns: ringutils/RingResponse

Ring handler to provide a standard error when an environment is not found.

Inputs: [environment :- schema/Str]
Returns: ringutils/RingResponse

Ring handler to provide a standard error when an environment is not found.
sourceraw docstring

EnvironmentClassesFileClassclj

Schema for an individual class found within an environment_classes file entry. Includes the name of the class and a vector of information about each parameter found in the class definition.

Schema for an individual class found within an environment_classes file
entry.  Includes the name of the class and a vector of information about
each parameter found in the class definition.
sourceraw docstring

EnvironmentClassesFileClassParameterclj

Schema for an individual parameter found in a class defined within an environment_classes file. Includes the name of the parameter. Optionally, if available in the parameter definition, includes the type, source text for the parameter's default value, and a literal (primitive data type) representation of the parameter's default value.

For example, if a class parameter were defined like this in a Puppet manifest ...

Integer $someint = 3

... then the map representation of that parameter would be:

{:name "someint", :type "Integer", :default_source "3", :default_literal 3 }

For a parameter default value which contains an expression - something that cannot be coerced into a primitive data type - the map representation omits the default_literal. For example, this parameter definition in a Puppet manifest ...

String $osfam = "$::osfamily"

... would produce a map representation which looks like this ...

{:name "osfam", :type "String", :default_source ""$::osfamily"", }

The data types that could be used in the value for a :default_literal may vary over time, as the Puppet language continues to evolve. For this reason, the more permissive schema/Any is used here. General data types that we could see based on current types that the Puppet language allows today are in the table below:

Puppet | :default_literal value

String | java.lang.String Boolean | java.lang.Boolean Float/Numeric | java.lang.Double Integer/Numeric | java.lang.Long Array | clojure.lang.LazySeq Hash | clojure.lang.PersistentTreeMap

For the Regexp, Undef, Default, any Hash objects (top-level or nested within another Array or Hash) whose keys are not of type String, and any Array or Hash objects (top-level or nested within another Array or Hash) which contain a Regexp, Undef, or Default typed value, the :default_literal value will not be populated. These are not populated because they cannot be represented in JSON transfer without some loss of fidelity as compared to what the original data type from the manifest was.

Schema for an individual parameter found in a class defined within an
environment_classes file.  Includes the name of the parameter.  Optionally,
if available in the parameter definition, includes the type, source text for
the parameter's default value, and a literal (primitive data type)
representation of the parameter's default value.

For example, if a class parameter were defined like this in a Puppet
manifest ...

  Integer $someint = 3

... then the map representation of that parameter would be:

{:name "someint",
 :type "Integer",
 :default_source "3",
 :default_literal 3
}

For a parameter default value which contains an expression - something that
cannot be coerced into a primitive data type - the map representation omits
the default_literal.  For example, this parameter definition in a Puppet
manifest ...

 String $osfam = "$::osfamily"

... would produce a map representation which looks like this ...

{:name "osfam",
 :type "String",
 :default_source ""$::osfamily"",
}

The data types that could be used in the value for a :default_literal may
vary over time, as the Puppet language continues to evolve.  For this
reason, the more permissive schema/Any is used here.  General data types
that we could see based on current types that the Puppet language allows
today are in the table below:

Puppet          | :default_literal value
================================================
String          | java.lang.String
Boolean         | java.lang.Boolean
Float/Numeric   | java.lang.Double
Integer/Numeric | java.lang.Long
Array           | clojure.lang.LazySeq
Hash            | clojure.lang.PersistentTreeMap

For the Regexp, Undef, Default, any Hash objects (top-level or nested within
another Array or Hash) whose keys are not of type String, and any Array
or Hash objects (top-level or nested within another Array or Hash) which
contain a Regexp, Undef, or Default typed value, the :default_literal value
will not be populated.  These are not populated because they cannot be
represented in JSON transfer without some loss of fidelity as compared to what
the original data type from the manifest was.
sourceraw docstring

EnvironmentClassesFileEntryclj

Schema for an individual file entry which is part of the return payload for an environment_classes request.

Schema for an individual file entry which is part of the return payload
for an environment_classes request.
sourceraw docstring

EnvironmentClassesFileWithClassesclj

Schema for an environment_classes file that was successfully parsed. Includes the path to the file and a vector of information about each class found in the file.

Schema for an environment_classes file that was successfully parsed.
Includes the path to the file and a vector of information about each class
found in the file.
sourceraw docstring

EnvironmentClassesFileWithErrorclj

Schema for an environment_classes file that could not be parsed. Includes the path to the file and an error string containing details about the problem encountered during parsing.

Schema for an environment_classes file that could not be parsed.  Includes
the path to the file and an error string containing details about the
problem encountered during parsing.
sourceraw docstring

EnvironmentClassesInfoclj

Schema for the return payload an environment_classes request.

Schema for the return payload an environment_classes request.
sourceraw docstring

EnvironmentModuleInfoclj

Schema for a given module that can be returned within the :modules key in EnvironmentModulesInfo.

Schema for a given module that can be returned within the
:modules key in EnvironmentModulesInfo.
sourceraw docstring

EnvironmentModulesInfoclj

Schema for the return payload for an environment_classes request.

Schema for the return payload for an environment_classes request.
sourceraw docstring

exception-matches?clj

(exception-matches? e pattern)

Inputs: [e :- Exception pattern :- schema/Regex] Returns: schema/Bool

Inputs: [e :- Exception pattern :- schema/Regex]
Returns: schema/Bool
sourceraw docstring

full-task-nameclj

(full-task-name module-name task-shortname)

Construct a full task name from the two components. If the task's short name is 'init', then the second component is omitted so the task name is just the module's name.

Construct a full task name from the two components. If the task's short name
is 'init', then the second component is omitted so the task name is just the
module's name.
sourceraw docstring

get-master-mountclj

(get-master-mount master-ns config-route)

Inputs: [master-ns :- schema/Keyword config-route] Returns: schema/Str

Get the webserver mount point that the master service is rooted under

Inputs: [master-ns :- schema/Keyword config-route]
Returns: schema/Str

Get the webserver mount point that the master service is rooted under
sourceraw docstring

get-master-route-configclj

(get-master-route-config master-ns config)

Inputs: [master-ns :- schema/Keyword config :- #:schema{Keyword schema/Any}]

Get the webserver route configuration for the master service

Inputs: [master-ns :- schema/Keyword config :- #:schema{Keyword schema/Any}]

Get the webserver route configuration for the master service
sourceraw docstring

handle-plan-details-jruby-exceptionclj

(handle-plan-details-jruby-exception jruby-exception environment module plan)

Given a JRuby RaiseException arising from a call to plan-details, constructs a 4xx error response if appropriate, otherwise re-throws.

Given a JRuby RaiseException arising from a call to plan-details, constructs
a 4xx error response if appropriate, otherwise re-throws.
sourceraw docstring

handle-task-details-jruby-exceptionclj

(handle-task-details-jruby-exception jruby-exception environment module task)

Given a JRuby RaiseException arising from a call to task-details, constructs a 4xx error response if appropriate, otherwise re-throws.

Given a JRuby RaiseException arising from a call to task-details, constructs
a 4xx error response if appropriate, otherwise re-throws.
sourceraw docstring

http-client-metrics-summaryclj

(http-client-metrics-summary metric-registry metric-ids-to-select)

Inputs: [metric-registry :- MetricRegistry metric-ids-to-select :- MetricIdsForStatus] Returns: {:metrics-data [http-client-common/MetricIdMetricData], :sorted-metrics-data [http-client-common/MetricIdMetricData]}

Inputs: [metric-registry :- MetricRegistry metric-ids-to-select :- MetricIdsForStatus]
Returns: {:metrics-data [http-client-common/MetricIdMetricData], :sorted-metrics-data [http-client-common/MetricIdMetricData]}
sourceraw docstring

if-none-match-from-requestclj

(if-none-match-from-request request)

Inputs: [request :- #:schema{Keyword schema/Any}] Returns: (schema/maybe String)

Retrieve the value of an 'If-None-Match' HTTP header from the supplied Ring request. If the header is not found, returns nil.

Inputs: [request :- #:schema{Keyword schema/Any}]
Returns: (schema/maybe String)

Retrieve the value of an 'If-None-Match' HTTP header from the supplied Ring
request.  If the header is not found, returns nil.
sourceraw docstring

info-serviceclj

(info-service request)
source

is-plan-error?clj

(is-plan-error? err)
source

is-task-error?clj

(is-task-error? err)
source

make-cacheable-handlerclj

(make-cacheable-handler info-fn jruby-service cache-enabled?)

Inputs: [info-fn :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) cache-enabled? :- schema/Bool] Returns: IFn

Given a function to retrieve information from the jruby protocol (referred to as an info service), builds a handler that honors the environment cache.

Inputs: [info-fn :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) cache-enabled? :- schema/Bool]
Returns: IFn

Given a function to retrieve information from the jruby protocol
(referred to as an info service), builds a handler that honors the
environment cache.
sourceraw docstring

manifest-info-from-jruby->manifest-info-for-jsonclj

(manifest-info-from-jruby->manifest-info-for-json file-info)

Inputs: [file-info :- Map$Entry] Returns: EnvironmentClassesFileEntry

Convert the per-manifest file information received from the jruby service into an appropriate map for use in serializing an environment_classes response to JSON.

Inputs: [file-info :- Map$Entry]
Returns: EnvironmentClassesFileEntry

Convert the per-manifest file information received from the jruby service
into an appropriate map for use in serializing an environment_classes
response to JSON.
sourceraw docstring

MasterStatusV1clj

source

max-heap-sizeclj

source

maybe-update-cache!clj

(maybe-update-cache! info env jruby-service svc-key request-tag content-version)

Inputs: [info :- #:schema{Any schema/Any} env :- schema/Str jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) svc-key :- (schema/maybe schema/Keyword) request-tag :- (schema/maybe String) content-version :- (schema/maybe schema/Int)] Returns: ringutils/RingResponse

Updates cached etag for a given info service if the etag is different than the etag requested.

Note, the content version at the time of etag computation must be supplied, the jruby service will only update the cache if the current content version of the cache has not changed while the etag was being computed.

Inputs: [info :- #:schema{Any schema/Any} env :- schema/Str jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) svc-key :- (schema/maybe schema/Keyword) request-tag :- (schema/maybe String) content-version :- (schema/maybe schema/Int)]
Returns: ringutils/RingResponse

Updates cached etag for a given info service if the etag is different
than the etag requested.

Note, the content version at the time of etag computation must be supplied,
the jruby service will only update the cache if the current content
version of the cache has not changed while the etag was being computed.
sourceraw docstring

meminfo-contentclj

(meminfo-content)

Read and return the contents of /proc/meminfo, if it exists. Otherwise return nil.

Read and return the contents of /proc/meminfo, if it exists.  Otherwise
return nil.
sourceraw docstring

MetricIdsForStatusclj

source

module-info-from-jruby->module-info-for-jsonclj

(module-info-from-jruby->module-info-for-json info-from-jruby environment)

Inputs: [info-from-jruby :- List environment :- schema/Str] Returns: EnvironmentModulesInfo

Creates a new map with a top level key name that corresponds to the requested environment and a top level key modules which contains the module information obtained from JRuby.

Inputs: [info-from-jruby :- List environment :- schema/Str]
Returns: EnvironmentModulesInfo

Creates a new map with a top level key `name` that corresponds to the
requested environment and a top level key `modules` which contains the module
information obtained from JRuby.
sourceraw docstring

module-not-foundclj

(module-not-found module)

Inputs: [module :- schema/Str] Returns: ringutils/RingResponse

Ring handler to provide a standard error when a module is not found.

Inputs: [module :- schema/Str]
Returns: ringutils/RingResponse

Ring handler to provide a standard error when a module is not found.
sourceraw docstring

not-modified-responseclj

(not-modified-response etag)

Inputs: [etag] Returns: ringutils/RingResponse

Create an HTTP 304 (Not Modified) response, including an HTTP 'Etag' header set to the supplied 'etag' parameter.

Inputs: [etag]
Returns: ringutils/RingResponse

Create an HTTP 304 (Not Modified) response, including an HTTP 'Etag'
header set to the supplied 'etag' parameter.
sourceraw docstring

obj->keywordclj

(obj->keyword obj)

Attempt to convert the supplied object to a Clojure keyword. On failure to do so, throws an IllegalArgumentException.

Attempt to convert the supplied object to a Clojure keyword.  On failure
to do so, throws an IllegalArgumentException.
sourceraw docstring

obj-or-ruby-symbol-as-stringclj

(obj-or-ruby-symbol-as-string obj)

If the supplied object is of type RubySymbol, returns a string representation of the RubySymbol. Otherwise, just returns the original object.

If the supplied object is of type RubySymbol, returns a string
representation of the RubySymbol.  Otherwise, just returns the original
object.
sourceraw docstring

plan-data->plan-detailsclj

(plan-data->plan-details plan-data module-name plan-name)

Inputs: [plan-data :- PlanData module-name :- schema/Str plan-name :- schema/Str] Returns: PlanDetails

Fills in a bare PlanData map by examining the files it refers to, returning PlanDetails.

Inputs: [plan-data :- PlanData module-name :- schema/Str plan-name :- schema/Str]
Returns: PlanDetails

Fills in a bare PlanData map by examining the files it refers to,
returning PlanDetails.
sourceraw docstring

plan-detailsclj

(plan-details jruby-service
              jruby-instance
              environment-name
              module-name
              plan-name)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) jruby-instance environment-name :- schema/Str module-name :- schema/Str plan-name :- schema/Str] Returns: PlanDetails

Returns a PlanDetails map for the plan matching the given environment, module, and name.

Will throw a JRuby RaiseException with (EnvironmentNotFound), (MissingModule), or (PlanNotFound) if any of those conditions occur.

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) jruby-instance environment-name :- schema/Str module-name :- schema/Str plan-name :- schema/Str]
Returns: PlanDetails

Returns a PlanDetails map for the plan matching the given environment,
module, and name.

Will throw a JRuby RaiseException with (EnvironmentNotFound),
(MissingModule), or (PlanNotFound) if any of those conditions occur.
sourceraw docstring

plan-details-fnclj

(plan-details-fn jruby-service)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)] Returns: IFn

Middleware function for constructing a Ring response from an incoming request for detailed plan information.

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)]
Returns: IFn

Middleware function for constructing a Ring response from an incoming
request for detailed plan information.
sourceraw docstring

plan-details-handlerclj

(plan-details-handler jruby-service)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)] Returns: IFn

Handler for processing an incoming /plans/:module/:plan-name Ring request

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)]
Returns: IFn

Handler for processing an incoming /plans/:module/:plan-name Ring request
sourceraw docstring

plan-not-foundclj

(plan-not-found plan)

Inputs: [plan :- schema/Str] Returns: ringutils/RingResponse

Ring handler to provide a standard error when a plan is not found.

Inputs: [plan :- schema/Str]
Returns: ringutils/RingResponse

Ring handler to provide a standard error when a plan is not found.
sourceraw docstring

PlanDataclj

Response from puppet's PlanInformationService for data on a single plan, after it has been converted to a Clojure map.

Response from puppet's PlanInformationService for data on a single
plan, *after* it has been converted to a Clojure map.
sourceraw docstring

PlanDetailsclj

A filled-in map of information about a plan.

A filled-in map of information about a plan.
sourceraw docstring

puppet-API-versionclj

source

puppet-server-http-client-metrics-for-statusclj

source

raw-transports->response-mapclj

(raw-transports->response-map data env)

Inputs: [data :- List env :- schema/Str]

Inputs: [data :- List env :- schema/Str]
sourceraw docstring

register-gauge!clj

(register-gauge! registry hostname metric-name metric-fn)
source

register-jvm-metrics!clj

(register-jvm-metrics! registry hostname)

Inputs: [registry :- MetricRegistry hostname :- schema/Str]

Inputs: [registry :- MetricRegistry hostname :- schema/Str]
sourceraw docstring

response-with-etagclj

(response-with-etag body etag)

Inputs: [body :- schema/Str etag :- schema/Str] Returns: ringutils/RingResponse

Create a Ring response, including the supplied 'body' and an HTTP 'Etag' header set to the supplied 'etag' parameter.

Inputs: [body :- schema/Str etag :- schema/Str]
Returns: ringutils/RingResponse

Create a Ring response, including the supplied 'body' and an HTTP 'Etag'
header set to the supplied 'etag' parameter.
sourceraw docstring

root-routesclj

(root-routes ruby-request-handler
             clojure-request-wrapper
             jruby-service
             wrap-with-jruby-queue-limit
             get-code-content-fn
             current-code-id-fn
             environment-class-cache-enabled
             boltlib-path
             certname)

Inputs: [ruby-request-handler :- IFn clojure-request-wrapper :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) wrap-with-jruby-queue-limit :- IFn get-code-content-fn :- IFn current-code-id-fn :- IFn environment-class-cache-enabled :- schema/Bool boltlib-path :- (schema/maybe [schema/Str]) certname :- schema/Str] Returns: bidi-schema/RoutePair

Creates all of the web routes for the master.

Inputs: [ruby-request-handler :- IFn clojure-request-wrapper :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) wrap-with-jruby-queue-limit :- IFn get-code-content-fn :- IFn current-code-id-fn :- IFn environment-class-cache-enabled :- schema/Bool boltlib-path :- (schema/maybe [schema/Str]) certname :- schema/Str]
Returns: bidi-schema/RoutePair

Creates all of the web routes for the master.
sourceraw docstring

sort-nested-info-mapsclj

(sort-nested-info-maps data)

For a data structure, recursively sort any nested maps and sets descending into map values, lists, vectors and set members as well. The result should be that all maps in the data structure become explicitly sorted with natural ordering. This can be used before serialization to ensure predictable serialization.

The returned data structure is not a transient so it is still able to be modified, therefore caution should be taken to avoid modification else the data will lose its sorted status.

This function was copypasta'd from clj-kitchensink's core/sort-nested-maps. sort-nested-maps can only deep sort a structure that contains native Clojure types, whereas this function includes a couple of changes which handle the sorting of the data structure returned from JRuby:

  1. This function sorts keys within any java.util.Map, as opposed to just an object for which map? returns true.

  2. This function attempts to coerces any keys found within a map to a Clojure keyword before using sorted-map to sort the keys. sorted-map would otherwise throw an error upon encountering a non-keyword type key.

For a data structure, recursively sort any nested maps and sets descending
into map values, lists, vectors and set members as well. The result should be
that all maps in the data structure become explicitly sorted with natural
ordering. This can be used before serialization to ensure predictable
serialization.

The returned data structure is not a transient so it is still able to be
modified, therefore caution should be taken to avoid modification else the
data will lose its sorted status.

This function was copypasta'd from clj-kitchensink's core/sort-nested-maps.
sort-nested-maps can only deep sort a structure that contains native Clojure
types, whereas this function includes a couple of changes which handle the
sorting of the data structure returned from JRuby:

1) This function sorts keys within any `java.util.Map`, as opposed to just an
   object for which `map?` returns true.

2) This function attempts to coerces any keys found within a map to a
   Clojure keyword before using `sorted-map` to sort the keys.
   `sorted-map` would otherwise throw an error upon encountering a
   non-keyword type key.
sourceraw docstring

static-file-content-request-handlerclj

(static-file-content-request-handler get-code-content)

Returns a function which is the main request handler for the /static_file_content endpoint, utilizing the provided implementation of get-code-content

Returns a function which is the main request handler for the
/static_file_content endpoint, utilizing the provided implementation of
`get-code-content`
sourceraw docstring

task-data->task-detailsclj

(task-data->task-details task-data
                         get-code-content
                         env-name
                         code-id
                         module-name
                         task-name)

Inputs: [task-data :- TaskData get-code-content :- IFn env-name :- schema/Str code-id :- (schema/maybe schema/Str) module-name :- schema/Str task-name :- schema/Str] Returns: TaskDetails

Fills in a bare TaskData map by examining the files it refers to, returning TaskDetails.

Inputs: [task-data :- TaskData get-code-content :- IFn env-name :- schema/Str code-id :- (schema/maybe schema/Str) module-name :- schema/Str task-name :- schema/Str]
Returns: TaskDetails

Fills in a bare TaskData map by examining the files it refers to,
returning TaskDetails.
sourceraw docstring

task-detailsclj

(task-details jruby-service
              jruby-instance
              code-content-fn
              environment-name
              code-id
              module-name
              task-name)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) jruby-instance code-content-fn :- IFn environment-name :- schema/Str code-id :- (schema/maybe schema/Str) module-name :- schema/Str task-name :- schema/Str] Returns: TaskDetails

Returns a TaskDetails map for the task matching the given environment, module, and name.

Will throw a JRuby RaiseException with (EnvironmentNotFound), (MissingModule), or (TaskNotFound) if any of those conditions occur.

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) jruby-instance code-content-fn :- IFn environment-name :- schema/Str code-id :- (schema/maybe schema/Str) module-name :- schema/Str task-name :- schema/Str]
Returns: TaskDetails

Returns a TaskDetails map for the task matching the given environment,
module, and name.

Will throw a JRuby RaiseException with (EnvironmentNotFound),
(MissingModule), or (TaskNotFound) if any of those conditions occur.
sourceraw docstring

task-details-fnclj

(task-details-fn jruby-service get-code-content-fn current-code-id-fn)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) get-code-content-fn :- IFn current-code-id-fn :- IFn] Returns: IFn

Middleware function for constructing a Ring response from an incoming request for detailed task information.

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) get-code-content-fn :- IFn current-code-id-fn :- IFn]
Returns: IFn

Middleware function for constructing a Ring response from an incoming
request for detailed task information.
sourceraw docstring

task-details-handlerclj

(task-details-handler jruby-service get-code-content-fn current-code-id-fn)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) get-code-content-fn :- IFn current-code-id-fn :- IFn] Returns: IFn

Handler for processing an incoming /tasks/:module/:task-name Ring request

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) get-code-content-fn :- IFn current-code-id-fn :- IFn]
Returns: IFn

Handler for processing an incoming /tasks/:module/:task-name Ring request
sourceraw docstring

task-file-uri-componentsclj

(task-file-uri-components file-id file)

The 'id' portion for a task implementation is a single component like 'foo.sh' and can never be nested in subdirectories. In that case we know the 'file' must be structured <environment>/<module root>/<module>/tasks/<filename>. Other task files are the path relative to the module root, in the form <module>/<mount>/<path> where <path> may have subdirectories. For those, we just slice that off the end of the file path and take the last component that remains as the module root.

The 'id' portion for a task implementation is a single component like
'foo.sh' and can never be nested in subdirectories. In that case we know the
'file' must be structured <environment>/<module root>/<module>/tasks/<filename>.
Other task files are the path relative to the module root, in the form
<module>/<mount>/<path> where <path> may have subdirectories. For those, we
just slice that off the end of the file path and take the last component that
remains as the module root.
sourceraw docstring

task-not-foundclj

(task-not-found task)

Inputs: [task :- schema/Str] Returns: ringutils/RingResponse

Ring handler to provide a standard error when a task is not found.

Inputs: [task :- schema/Str]
Returns: ringutils/RingResponse

Ring handler to provide a standard error when a task is not found.
sourceraw docstring

TaskDataclj

Response from puppet's TaskInformationService for data on a single task, after it has been converted to a Clojure map.

Response from puppet's TaskInformationService for data on a single
task, *after* it has been converted to a Clojure map.
sourceraw docstring

TaskDetailsclj

A filled-in map of information about a task.

A filled-in map of information about a task.
sourceraw docstring

v1-statusclj

(v1-status http-metrics http-client-metric-ids-for-status metric-registry level)

Inputs: [http-metrics :- http-metrics/HttpMetrics http-client-metric-ids-for-status :- MetricIdsForStatus metric-registry :- MetricRegistry level :- status-core/ServiceStatusDetailLevel] Returns: status-core/StatusCallbackResponse

Inputs: [http-metrics :- http-metrics/HttpMetrics http-client-metric-ids-for-status :- MetricIdsForStatus metric-registry :- MetricRegistry level :- status-core/ServiceStatusDetailLevel]
Returns: status-core/StatusCallbackResponse
sourceraw docstring

v3-clojure-routesclj

(v3-clojure-routes jruby-service
                   get-code-content-fn
                   current-code-id-fn
                   cache-enabled
                   wrap-with-jruby-queue-limit
                   boltlib-path)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) get-code-content-fn :- IFn current-code-id-fn :- IFn cache-enabled :- schema/Bool wrap-with-jruby-queue-limit :- IFn boltlib-path :- (schema/maybe [schema/Str])] Returns: bidi-schema/RoutePair

v3 route tree for the clojure side of the master service.

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) get-code-content-fn :- IFn current-code-id-fn :- IFn cache-enabled :- schema/Bool wrap-with-jruby-queue-limit :- IFn boltlib-path :- (schema/maybe [schema/Str])]
Returns: bidi-schema/RoutePair

v3 route tree for the clojure side of the master service.
sourceraw docstring

v3-routesclj

(v3-routes ruby-request-handler
           clojure-request-wrapper
           jruby-service
           get-code-content-fn
           current-code-id-fn
           environment-class-cache-enabled
           wrap-with-jruby-queue-limit
           boltlib-path
           certname)

Inputs: [ruby-request-handler :- IFn clojure-request-wrapper :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) get-code-content-fn :- IFn current-code-id-fn :- IFn environment-class-cache-enabled :- schema/Bool wrap-with-jruby-queue-limit :- IFn boltlib-path :- (schema/maybe [schema/Str]) certname :- schema/Str] Returns: bidi-schema/RoutePair

Creates the routes to handle the master's '/v3' routes, which includes '/environments' and the non-CA indirected routes. The CA-related endpoints are handled separately by the CA service.

Inputs: [ruby-request-handler :- IFn clojure-request-wrapper :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) get-code-content-fn :- IFn current-code-id-fn :- IFn environment-class-cache-enabled :- schema/Bool wrap-with-jruby-queue-limit :- IFn boltlib-path :- (schema/maybe [schema/Str]) certname :- schema/Str]
Returns: bidi-schema/RoutePair

Creates the routes to handle the master's '/v3' routes, which
 includes '/environments' and the non-CA indirected routes. The CA-related
 endpoints are handled separately by the CA service.
sourceraw docstring

v3-ruby-routesclj

(v3-ruby-routes request-handler certname)

Inputs: [request-handler :- IFn certname :- schema/Str] Returns: bidi-schema/RoutePair

v3 route tree for the ruby side of the master service.

Inputs: [request-handler :- IFn certname :- schema/Str]
Returns: bidi-schema/RoutePair

v3 route tree for the ruby side of the master service.
sourceraw docstring

v4-catalog-fnclj

(v4-catalog-fn jruby-service current-code-id-fn)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) current-code-id-fn :- IFn] Returns: IFn

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) current-code-id-fn :- IFn]
Returns: IFn
sourceraw docstring

v4-catalog-handlerclj

(v4-catalog-handler jruby-service
                    wrap-with-jruby-queue-limit
                    current-code-id-fn)

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) wrap-with-jruby-queue-limit :- IFn current-code-id-fn :- IFn] Returns: IFn

Inputs: [jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) wrap-with-jruby-queue-limit :- IFn current-code-id-fn :- IFn]
Returns: IFn
sourceraw docstring

v4-routesclj

(v4-routes clojure-request-wrapper
           jruby-service
           wrap-with-jruby-queue-limit
           current-code-id-fn)

Inputs: [clojure-request-wrapper :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) wrap-with-jruby-queue-limit :- IFn current-code-id-fn :- IFn] Returns: bidi-schema/RoutePair

Inputs: [clojure-request-wrapper :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService) wrap-with-jruby-queue-limit :- IFn current-code-id-fn :- IFn]
Returns: bidi-schema/RoutePair
sourceraw docstring

valid-env-name?clj

(valid-env-name? string)
source

valid-static-file-path?clj

(valid-static-file-path? path)

Inputs: [path :- schema/Str]

Helper function to decide if a static_file_content path is valid. The access here is designed to mimic Puppet's file_content endpoint.

Inputs: [path :- schema/Str]

Helper function to decide if a static_file_content path is valid.
The access here is designed to mimic Puppet's file_content endpoint.
sourceraw docstring

validate-memory-requirements!clj

(validate-memory-requirements!)

On Linux Distributions, parses the /proc/meminfo file to determine the total amount of System RAM, and throws an exception if that is less than 1.1 times the maximum heap size of the JVM. This is done so that the JVM doesn't fail later due to an Out of Memory error.

On Linux Distributions, parses the /proc/meminfo file to determine
the total amount of System RAM, and throws an exception if that
is less than 1.1 times the maximum heap size of the JVM. This is done
so that the JVM doesn't fail later due to an Out of Memory error.
sourceraw docstring

validated-bodyclj

(validated-body body schema)
source

wrap-middlewareclj

(wrap-middleware handler authorization-fn puppet-version)

Inputs: [handler :- IFn authorization-fn :- IFn puppet-version :- schema/Str] Returns: IFn

Inputs: [handler :- IFn authorization-fn :- IFn puppet-version :- schema/Str]
Returns: IFn
sourceraw docstring

wrap-with-cache-checkclj

(wrap-with-cache-check handler jruby-service)

Inputs: [handler :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)] Returns: IFn

Middleware function which validates whether or not the If-None-Match header on an incoming cacheable request matches the last Etag computed for the environment whose info is being requested.

If the two match, the middleware function returns an HTTP 304 (Not Modified) Ring response. If the two do not match, the request is threaded through to the supplied handler function.

Inputs: [handler :- IFn jruby-service :- (schema/protocol jruby-protocol/JRubyPuppetService)]
Returns: IFn

Middleware function which validates whether or not the If-None-Match
header on an incoming cacheable request matches the last Etag
computed for the environment whose info is being requested.

If the two match, the middleware function returns an HTTP 304 (Not Modified)
Ring response.  If the two do not match, the request is threaded through to
the supplied handler function.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close