Catalog generation and manipulation
A suite of functions that aid in constructing random catalogs, or randomly modifying an existing catalog (wire format or parsed).
Catalog generation and manipulation A suite of functions that aid in constructing random catalogs, or randomly modifying an existing catalog (wire format or parsed).
Puppet catalog parsing
Functions that handle conversion of catalogs from wire format to internal PuppetDB format.
The wire format is described in detail in the spec.
There are a number of transformations we apply to wire format catalogs during conversion to our internal format; while wire format catalogs contain complete records of all resources and edges, and most things are properly encoded as lists or maps, there are still a number of places where structure is absent or lacking:
Resource specifiers are represented as opaque strings, like
Class[Foobar], as opposed to something like
{"type" "Class" "title" "Foobar"}
Tags are represented as lists (and may contain duplicates) instead of sets
Resources are represented as a list instead of a map, making operations that need to correlate against specific resources unneccesarily difficult
Keys to all maps are strings (to conform with JSON), instead of more convenient Clojure keywords
Unless otherwise indicated, all terminology for catalog components matches terms listed in the spec.
A map of the form {:type "Class" :title "Foobar"}. This is a
unique identifier for a resource within a catalog.
A map that represents a single resource in a catalog:
{:type "..."
:title "..."
:... "..."
:tags #{"tag1", "tag2", ...}
:parameters {:name1 "value1"
:name2 "value2"
...}}
Certain attributes are treated special:
:type and :title are used to produce a resource-spec for
this resourceA representation of an "edge" (dependency or containment) in the catalog. All edges have the following form:
{:source <resource spec>
:target <resource spec>
:relationship <relationship id>}
A relationship identifier can be one of:
:contains:required-by:notifies:before:subscription-ofA wire-format-neutral representation of a Puppet catalog. It is a map with the following structure:
{:certname "..."
:version "..."
:resources {<resource-spec> <resource>
<resource-spec> <resource>
...}
:edges #(<dependency-spec>,
<dependency-spec>,
...)}
Puppet catalog parsing
Functions that handle conversion of catalogs from wire format to
internal PuppetDB format.
The wire format is described in detail in [the spec](../spec/catalog-wire-format.md).
There are a number of transformations we apply to wire format
catalogs during conversion to our internal format; while wire
format catalogs contain complete records of all resources and
edges, and most things are properly encoded as lists or maps, there
are still a number of places where structure is absent or lacking:
1. Resource specifiers are represented as opaque strings, like
`Class[Foobar]`, as opposed to something like
`{"type" "Class" "title" "Foobar"}`
2. Tags are represented as lists (and may contain duplicates)
instead of sets
3. Resources are represented as a list instead of a map, making
operations that need to correlate against specific resources
unneccesarily difficult
4. Keys to all maps are strings (to conform with JSON), instead of
more convenient Clojure keywords
### Terminology
Unless otherwise indicated, all terminology for catalog components
matches terms listed in [the spec](../spec/catalog-wire-format.md).
### Transformed constructs
### Resource Specifier (resource-spec)
A map of the form `{:type "Class" :title "Foobar"}`. This is a
unique identifier for a resource within a catalog.
### Resource
A map that represents a single resource in a catalog:
{:type "..."
:title "..."
:... "..."
:tags #{"tag1", "tag2", ...}
:parameters {:name1 "value1"
:name2 "value2"
...}}
Certain attributes are treated special:
* `:type` and `:title` are used to produce a `resource-spec` for
this resource
### Edge
A representation of an "edge" (dependency or containment) in the
catalog. All edges have the following form:
{:source <resource spec>
:target <resource spec>
:relationship <relationship id>}
A relationship identifier can be one of:
* `:contains`
* `:required-by`
* `:notifies`
* `:before`
* `:subscription-of`
### Catalog
A wire-format-neutral representation of a Puppet catalog. It is a
map with the following structure:
{:certname "..."
:version "..."
:resources {<resource-spec> <resource>
<resource-spec> <resource>
...}
:edges #(<dependency-spec>,
<dependency-spec>,
...)}cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |