Skip to content

Commit ff2c178

Browse files
author
Kevin Paulisse
committed
Document some parameters for catalog
1 parent 3f79ac7 commit ff2c178

1 file changed

Lines changed: 96 additions & 7 deletions

File tree

doc/dev/api/v1/calls/catalog.md

Lines changed: 96 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,107 @@
55
`catalog` returns an `OctocatalogDiff::Catalog` object built with the octocatalog-diff compiler, obtained from a Puppet server, or read in from a file. This is analogous to using the `--catalog-only` option with the octocatalog-diff command-line script.
66

77
```
8-
catalog_obj = OctocatalogDiff::API::V1.catalog(
9-
10-
)
8+
catalog_obj = OctocatalogDiff::API::V1.catalog(<Hash>)
9+
#=> OctocatalogDiff::API::V1::Catalog
1110
```
1211

13-
## Options
12+
The return value is an [`OctocatalogDiff::API::V1::Catalog`](/doc/dev/api/v1/objects/catalog.md) object.
1413

14+
For an example, see [catalog-builder-local-files.rb](/examples/api/v1/catalog-builder-local-files.rb).
1515

16-
**NOTE**: Additional options as described in the [options reference](/doc/optionsref.md) may also have an effect on catalog generation.
16+
## Parameters
1717

18-
## Return value
18+
The `catalog` method takes one argument, which is a Hash containing parameters.
1919

20-
The return value is an [`OctocatalogDiff::API::V1::Catalog`](/doc/dev/api/v1/objects/catalog.md) object.
20+
The list of parameters here is not exhaustive. The `.catalog` method accepts most parameters described in [Configuration](/doc/configuration.md), [Building catalogs instead of diffing catalogs](/doc/advanced-catalog-only.md), and [Command line options reference](/doc/optionsref.md).
21+
22+
### Global parameters
23+
24+
#### `:logger` (Logger, Optional)
25+
26+
Debugging and informational messages will be logged to this object as the catalog is built.
27+
28+
If no Logger object is passed, these messages will be silently discarded.
29+
30+
#### `:node` (String, Required)
31+
32+
The node name whose catalog is to be compiled or obtained. This should be the fully qualified domain name that matches the node's name as seen in Puppet.
33+
34+
### Computed catalog parameters
35+
36+
#### `:basedir` (String, Optional)
37+
38+
Directory that contains a git repository with the Puppet code. Use in conjunction with `:to_branch` to specify the branch name that should be checked out.
39+
40+
#### `:bootstrap_script` (String, Optional)
41+
42+
Path to a script to run after checking out the selected branch of Puppet code from the git repository. See [Bootstrapping your Puppet checkout](/doc/advanced-bootstrap.md) for details.
43+
44+
#### `:bootstrapped_to_dir` (String, Optional)
45+
46+
Directory that is already prepared ("bootstrapped") and can have Puppet run against its contents to compile the catalog.
47+
48+
Often this means that you have done the following to this directory:
49+
50+
- Checked out the necessary branch of Puppet code from your version control system
51+
- Installed any third party modules (e.g. with librarian-puppet or r10k)
52+
53+
#### `:enc` (String, Optional)
54+
55+
File path to your External Node Classifier.
56+
57+
See [Configuring octocatalog-diff to use ENC](/doc/configuration-enc.md) for details on using octocatalog-diff with an External Node Classifier.
58+
59+
#### `:fact_file` (String, Optional)
60+
61+
Path to the file that contains the facts for the node whose catalog you are going to compile.
62+
63+
Generally, must either specify the fact file, or [configure octocatalog-diff to use PuppetDB](/doc/configuration-puppetdb.md) to retrieve node facts.
64+
65+
#### `:hiera_config` (String, Optional)
66+
67+
Path to the Hiera configuration file (generally named `hiera.yaml`) for your Puppet installation. Please see [Configuring octocatalog-diff to use Hiera](/doc/configuration-hiera.md) for details on Hiera configuration.
68+
69+
#### `:hiera_path` (String, Optional)
70+
71+
Directory within your Puppet installation where Hiera data is stored. Please see [Configuring octocatalog-diff to use Hiera](/doc/configuration-hiera.md) for details on Hiera configuration.
72+
73+
If your Puppet setup is modeled after the [Puppet control repository template](https://github.com/puppetlabs/control-repo), the correct setting for `:hiera_path` is `'hieradata'`.
74+
75+
#### `:puppet_binary` (String, Optional)
76+
77+
Path to the Puppet binary on your system. If not specified, default locations will be checked.
78+
79+
Please refer to [Configuring octocatalog-diff to use Puppet](/doc/configuration-puppet.md) for details of connecting octocatalog-diff to your Puppet installation.
80+
81+
#### `:puppetdb_url` (String, Optional)
82+
83+
URL to PuppetDB. See [Configuring octocatalog-diff to use PuppetDB](/doc/configuration-puppetdb.md) for instructions on this setting, and other settings that may be needed in your environment.
84+
85+
#### `:to_branch` (String, Optional)
86+
87+
Branch name in git repository to use for Puppet code. This option must be used in conjunction with `:basedir` so that code can be located.
2188

2289
## Exceptions
90+
91+
The following exceptions may occur during the compilation of a catalog:
92+
93+
- `OctocatalogDiff::Errors::BootstrapError`
94+
95+
Bootstrapping failed.
96+
97+
- `OctocatalogDiff::Errors::CatalogError`
98+
99+
Catalog failed to compile. Please note that whenever possible, a `OctocatalogDiff::API::V1::Catalog` object is still constructed for a failed catalog, with `#valid?` returning false.
100+
101+
- `OctocatalogDiff::Errors::GitCheckoutError`
102+
103+
Git checkout failed.
104+
105+
- `OctocatalogDiff::Errors::PuppetVersionError`
106+
107+
The version of Puppet could not be determined, generally because the Puppet binary was not found, or does not respond as expected to `puppet version`.
108+
109+
- `OctocatalogDiff::Errors::ReferenceValidationError`
110+
111+
See [Catalog validation](/doc/advanced-catalog-validation.md).

0 commit comments

Comments
 (0)