octocatalog-diff 0.5.6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/doc/CHANGELOG.md +23 -5
  4. data/doc/advanced-bootstrap.md +25 -0
  5. data/doc/advanced-catalog-validation.md +41 -0
  6. data/doc/advanced-environments.md +93 -0
  7. data/doc/advanced-hiera-path-stripping.md +2 -0
  8. data/doc/advanced.md +2 -0
  9. data/doc/configuration-enc.md +34 -0
  10. data/doc/dev/releasing.md +40 -2
  11. data/doc/dev/run-from-branch.md +62 -0
  12. data/doc/installation.md +6 -0
  13. data/doc/optionsref.md +84 -22
  14. data/lib/octocatalog-diff/bootstrap.rb +2 -0
  15. data/lib/octocatalog-diff/catalog-diff/cli.rb +4 -1
  16. data/lib/octocatalog-diff/catalog-diff/cli/catalogs.rb +8 -2
  17. data/lib/octocatalog-diff/catalog-diff/cli/diffs.rb +2 -0
  18. data/lib/octocatalog-diff/catalog-diff/cli/helpers/fact_override.rb +3 -2
  19. data/lib/octocatalog-diff/catalog-diff/cli/options.rb +14 -2
  20. data/lib/octocatalog-diff/catalog-diff/cli/options/basedir.rb +2 -0
  21. data/lib/octocatalog-diff/catalog-diff/cli/options/bootstrap_current.rb +2 -0
  22. data/lib/octocatalog-diff/catalog-diff/cli/options/bootstrap_environment.rb +2 -0
  23. data/lib/octocatalog-diff/catalog-diff/cli/options/bootstrap_script.rb +2 -0
  24. data/lib/octocatalog-diff/catalog-diff/cli/options/bootstrap_then_exit.rb +2 -0
  25. data/lib/octocatalog-diff/catalog-diff/cli/options/bootstrapped_dirs.rb +2 -0
  26. data/lib/octocatalog-diff/catalog-diff/cli/options/cached_master_dir.rb +2 -0
  27. data/lib/octocatalog-diff/catalog-diff/cli/options/catalog_only.rb +2 -0
  28. data/lib/octocatalog-diff/catalog-diff/cli/options/color.rb +2 -0
  29. data/lib/octocatalog-diff/catalog-diff/cli/options/command_line.rb +19 -0
  30. data/lib/octocatalog-diff/catalog-diff/cli/options/compare_file_text.rb +2 -0
  31. data/lib/octocatalog-diff/catalog-diff/cli/options/create_symlinks.rb +20 -0
  32. data/lib/octocatalog-diff/catalog-diff/cli/options/debug.rb +2 -0
  33. data/lib/octocatalog-diff/catalog-diff/cli/options/debug_bootstrap.rb +2 -0
  34. data/lib/octocatalog-diff/catalog-diff/cli/options/display_datatype_changes.rb +2 -0
  35. data/lib/octocatalog-diff/catalog-diff/cli/options/display_detail_add.rb +2 -0
  36. data/lib/octocatalog-diff/catalog-diff/cli/options/display_source_file_line.rb +2 -0
  37. data/lib/octocatalog-diff/catalog-diff/cli/options/enc.rb +2 -0
  38. data/lib/octocatalog-diff/catalog-diff/cli/options/environment.rb +19 -0
  39. data/lib/octocatalog-diff/catalog-diff/cli/options/existing_catalogs.rb +2 -0
  40. data/lib/octocatalog-diff/catalog-diff/cli/options/fact_file.rb +2 -0
  41. data/lib/octocatalog-diff/catalog-diff/cli/options/fact_override.rb +2 -0
  42. data/lib/octocatalog-diff/catalog-diff/cli/options/facts_terminus.rb +2 -0
  43. data/lib/octocatalog-diff/catalog-diff/cli/options/from_puppetdb.rb +2 -0
  44. data/lib/octocatalog-diff/catalog-diff/cli/options/header.rb +2 -0
  45. data/lib/octocatalog-diff/catalog-diff/cli/options/hiera_config.rb +2 -0
  46. data/lib/octocatalog-diff/catalog-diff/cli/options/hiera_path.rb +2 -0
  47. data/lib/octocatalog-diff/catalog-diff/cli/options/hiera_path_strip.rb +2 -0
  48. data/lib/octocatalog-diff/catalog-diff/cli/options/hostname.rb +2 -0
  49. data/lib/octocatalog-diff/catalog-diff/cli/options/ignore.rb +2 -0
  50. data/lib/octocatalog-diff/catalog-diff/cli/options/ignore_attr.rb +2 -0
  51. data/lib/octocatalog-diff/catalog-diff/cli/options/ignore_tags.rb +2 -0
  52. data/lib/octocatalog-diff/catalog-diff/cli/options/include_tags.rb +2 -0
  53. data/lib/octocatalog-diff/catalog-diff/cli/options/master_cache_branch.rb +2 -0
  54. data/lib/octocatalog-diff/catalog-diff/cli/options/output_file.rb +2 -0
  55. data/lib/octocatalog-diff/catalog-diff/cli/options/output_format.rb +2 -0
  56. data/lib/octocatalog-diff/catalog-diff/cli/options/parallel.rb +2 -0
  57. data/lib/octocatalog-diff/catalog-diff/cli/options/parser.rb +2 -0
  58. data/lib/octocatalog-diff/catalog-diff/cli/options/pass_env_vars.rb +2 -0
  59. data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_ssl_ca.rb +2 -0
  60. data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_ssl_client_cert.rb +2 -0
  61. data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_ssl_client_key.rb +2 -0
  62. data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_token.rb +2 -0
  63. data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_token_file.rb +2 -0
  64. data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_url.rb +2 -0
  65. data/lib/octocatalog-diff/catalog-diff/cli/options/preserve_environments.rb +16 -0
  66. data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_binary.rb +2 -0
  67. data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_master.rb +2 -0
  68. data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_master_api_version.rb +2 -0
  69. data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_master_ssl_ca.rb +2 -0
  70. data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_master_ssl_client_cert.rb +2 -0
  71. data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_master_ssl_client_key.rb +2 -0
  72. data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_api_version.rb +14 -0
  73. data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_ssl_ca.rb +2 -0
  74. data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_ssl_client_cert.rb +2 -0
  75. data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_ssl_client_key.rb +2 -0
  76. data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_ssl_client_password.rb +2 -0
  77. data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_ssl_client_password_file.rb +2 -0
  78. data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_url.rb +2 -0
  79. data/lib/octocatalog-diff/catalog-diff/cli/options/quiet.rb +2 -0
  80. data/lib/octocatalog-diff/catalog-diff/cli/options/retry_failed_catalog.rb +2 -0
  81. data/lib/octocatalog-diff/catalog-diff/cli/options/safe_to_delete_cached_master_dir.rb +2 -0
  82. data/lib/octocatalog-diff/catalog-diff/cli/options/storeconfigs.rb +2 -0
  83. data/lib/octocatalog-diff/catalog-diff/cli/options/suppress_absent_file_details.rb +2 -0
  84. data/lib/octocatalog-diff/catalog-diff/cli/options/to_from_branch.rb +2 -0
  85. data/lib/octocatalog-diff/catalog-diff/cli/options/validate_references.rb +27 -0
  86. data/lib/octocatalog-diff/catalog-diff/cli/printer.rb +2 -0
  87. data/lib/octocatalog-diff/catalog-diff/differ.rb +2 -0
  88. data/lib/octocatalog-diff/catalog-diff/display.rb +2 -0
  89. data/lib/octocatalog-diff/catalog-diff/display/json.rb +2 -0
  90. data/lib/octocatalog-diff/catalog-diff/display/text.rb +2 -0
  91. data/lib/octocatalog-diff/catalog-util/bootstrap.rb +7 -1
  92. data/lib/octocatalog-diff/catalog-util/builddir.rb +49 -13
  93. data/lib/octocatalog-diff/catalog-util/cached_master_directory.rb +2 -0
  94. data/lib/octocatalog-diff/catalog-util/command.rb +61 -1
  95. data/lib/octocatalog-diff/catalog-util/enc.rb +2 -0
  96. data/lib/octocatalog-diff/catalog-util/enc/noop.rb +2 -0
  97. data/lib/octocatalog-diff/catalog-util/enc/pe.rb +2 -0
  98. data/lib/octocatalog-diff/catalog-util/enc/pe/v1.rb +2 -0
  99. data/lib/octocatalog-diff/catalog-util/enc/script.rb +3 -1
  100. data/lib/octocatalog-diff/catalog-util/facts.rb +2 -0
  101. data/lib/octocatalog-diff/catalog-util/fileresources.rb +19 -14
  102. data/lib/octocatalog-diff/catalog-util/git.rb +2 -0
  103. data/lib/octocatalog-diff/catalog.rb +75 -2
  104. data/lib/octocatalog-diff/catalog/computed.rb +16 -0
  105. data/lib/octocatalog-diff/catalog/json.rb +2 -0
  106. data/lib/octocatalog-diff/catalog/noop.rb +2 -0
  107. data/lib/octocatalog-diff/catalog/puppetdb.rb +2 -0
  108. data/lib/octocatalog-diff/catalog/puppetmaster.rb +8 -2
  109. data/lib/octocatalog-diff/facts.rb +2 -0
  110. data/lib/octocatalog-diff/facts/json.rb +2 -0
  111. data/lib/octocatalog-diff/facts/puppetdb.rb +10 -1
  112. data/lib/octocatalog-diff/facts/yaml.rb +2 -0
  113. data/lib/octocatalog-diff/puppetdb.rb +2 -0
  114. data/lib/octocatalog-diff/util/colored.rb +2 -0
  115. data/lib/octocatalog-diff/util/httparty.rb +2 -0
  116. data/lib/octocatalog-diff/util/parallel.rb +4 -1
  117. data/lib/octocatalog-diff/util/puppetversion.rb +2 -0
  118. data/lib/octocatalog-diff/version.rb +2 -0
  119. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 373d19f3ac425f068b91f3fc3a32185375fbe13e
4
- data.tar.gz: 344a4e7024b88ed9e1e75b60639269fa38cb5033
3
+ metadata.gz: 39148d81d6f446067f306d988b78a3544f381a47
4
+ data.tar.gz: e3212a9a0510be17e5bad0280baa66451cc3d77c
5
5
  SHA512:
6
- metadata.gz: 50a77d5680032271a238a60ba1b33263a5f0797fdd2aad8bef18b643221e03b803b9c480e8b4da850eae74f2648aa6baf9dd6d6d6d430c257d6861a61efb78dc
7
- data.tar.gz: 40f1df38c8b0f4ac1c7cd648bbf238b4b21f881291de9a8960c8773c9cf93339e1fddc597f4a4a954c3a0e85fde4979ee897610113b774a33ca371e914d7e429
6
+ metadata.gz: a2abdf4c5a2604c70938a50875dacc5af83e4ad4aeaa08ad2ac1e1c97a61c1cd4f47ad928cc361919993db5fb9fa5e70c76f29d172761e8c8bb8b3f68cf62e12
7
+ data.tar.gz: 2dbc74ab05804f35ae3106ccdbf494952f262110335e57c57f92f719387071289272fec6f6cea4db30b18b07d745b650a10708120ca9cda44e18a5e0ea3776fd
data/.version CHANGED
@@ -1 +1 @@
1
- 0.5.6
1
+ 0.6.0
@@ -8,11 +8,29 @@
8
8
  </tr>
9
9
  </thead><tbody>
10
10
  <tr valign=top>
11
+ <td>0.6.0</td>
12
+ <td>2017-01-04</td>
13
+ <td>
14
+ <ul>
15
+ <li><a href="https://github.com/github/octocatalog-diff/pull/45">#45</a>: Support for alternate environments in hiera configuration</li>
16
+ <li><a href="https://github.com/github/octocatalog-diff/pull/43">#43</a>: Consider aliased resources in validation</li>
17
+ <li><a href="https://github.com/github/octocatalog-diff/pull/39">#39</a>: Pass command line arguments to Puppet during catalog compilation</li>
18
+ <li><a href="https://github.com/github/octocatalog-diff/pull/38">#38</a>: Preserve and select environments</li>
19
+ <li><a href="https://github.com/github/octocatalog-diff/pull/37">#37</a>: Consistent sorting of equally weighted options</li>
20
+ <li><a href="https://github.com/github/octocatalog-diff/pull/36">#36</a>: Validate before, notify, require, subscribe references</li>
21
+ <li><a href="https://github.com/github/octocatalog-diff/pull/34">#34</a>: Allow bootstrap script to start with /</li>
22
+ <li><a href="https://github.com/github/octocatalog-diff/pull/33">#33</a>: Double-escape facts passed to Puppet master</li>
23
+ <li><a href="https://github.com/github/octocatalog-diff/pull/32">#32</a>: Rewrite hiera data directory for multiple backends</li>
24
+ <li><a href="https://github.com/github/octocatalog-diff/pull/24">#24</a>: Support PuppetDB API v3</li>
25
+ </ul>
26
+ </td>
27
+ </tr>
28
+ <tr valign=top>
11
29
  <td>0.5.6</td>
12
30
  <td>2016-11-16</td>
13
31
  <td>
14
32
  <ul>
15
- <li><a href="https://github.com/github/octocatalog-diff/pull/20">https://github.com/github/octocatalog-diff/pull/20</a>: Use modulepath from environment.conf to inform lookup directories for <code>--compare-file-text</code> feature</li>
33
+ <li><a href="https://github.com/github/octocatalog-diff/pull/20">#20</a>: Use modulepath from environment.conf to inform lookup directories for <code>--compare-file-text</code> feature</li>
16
34
  </ul>
17
35
  </td>
18
36
  </tr>
@@ -28,9 +46,9 @@ Unreleased internal version
28
46
  <td>2016-11-07</td>
29
47
  <td>
30
48
  <ul>
31
- <li><a href="https://github.com/github/octocatalog-diff/pull/16">https://github.com/github/octocatalog-diff/pull/16</a>: environment running <code>puppet --version</code></li>
32
- <li><a href="https://github.com/github/octocatalog-diff/pull/5">https://github.com/github/octocatalog-diff/pull/5</a>: bootstrap debugging</li>
33
- <li><a href="https://github.com/github/octocatalog-diff/pull/17">https://github.com/github/octocatalog-diff/pull/17</a>: hiera simplification and <code>--hiera-path</code> option</li>
49
+ <li><a href="https://github.com/github/octocatalog-diff/pull/16">#16</a>: environment running <code>puppet --version</code></li>
50
+ <li><a href="https://github.com/github/octocatalog-diff/pull/5">#5</a>: bootstrap debugging</li>
51
+ <li><a href="https://github.com/github/octocatalog-diff/pull/17">#17</a>: hiera simplification and <code>--hiera-path</code> option</li>
34
52
  </ul>
35
53
  </td>
36
54
  </tr>
@@ -39,7 +57,7 @@ Unreleased internal version
39
57
  <td>2016-10-31</td>
40
58
  <td>
41
59
  <ul>
42
- <li><a href="https://github.com/github/octocatalog-diff/pull/10">https://github.com/github/octocatalog-diff/pull/10</a>: facts terminus optimization</li>
60
+ <li><a href="https://github.com/github/octocatalog-diff/pull/10">#10</a>: facts terminus optimization</li>
43
61
  </ul>
44
62
  </td>
45
63
  </tr>
@@ -31,3 +31,28 @@ The [example configuration file](/examples/octocatalog-diff.cfg.rb) contains an
31
31
  # settings[:bootstrap_script] = '/etc/puppetlabs/repo-bootstrap.sh' # Absolute path
32
32
  # settings[:bootstrap_script] = 'script/bootstrap' # Relative path
33
33
  ```
34
+
35
+ ## Bootstrap environment
36
+
37
+ When the bootstrap script runs, a limited set of environment variables are passed from the shell running octocatalog-diff. Only these variables are set:
38
+
39
+ - `HOME`
40
+ - `PATH`
41
+ - `PWD` (set to the base directory of your Puppet checkout)
42
+ - `BASEDIR` (as explicitly set with `--basedir` CLI option or `settings[:basedir]` setting)
43
+
44
+ If you wish to set additional environment variables for your bootstrap script, you may do so via the `--bootstrap-environment VAR=value` command line flag, or by defining `settings[:bootstrap_environment] = { 'VAR' => 'value' }` in your configuration file.
45
+
46
+ As an example, consider that your bootstrap script is written in Python, and needs the `PYTHONPATH` variable set to `/usr/local/lib/python-custom`. Even if this environment variable is set when octocatalog-diff is run, it will not be available to the bootstrap script. You may supply it via the command line:
47
+
48
+ ```
49
+ octocatalog-diff --bootstrap-environment PYTHONPATH=/usr/local/lib/python-custom ...
50
+ ```
51
+
52
+ Or you may specify it in your configuration file:
53
+
54
+ ```
55
+ settings[:bootstrap_environment] = {
56
+ 'PYTHONPATH' => '/usr/local/lib/python-custom'
57
+ }
58
+ ```
@@ -0,0 +1,41 @@
1
+ # Catalog validation
2
+
3
+ `octocatalog-diff` contains additional functionality to validate catalogs, based on configurable criteria.
4
+
5
+ Catalog validation features include:
6
+
7
+ - Validate references: Ensure resources targeted by `before`, `notify`, `require`, and/or `subscribe` exist in the catalog
8
+
9
+ ## Validate references
10
+
11
+ `octocatalog-diff` includes the ability to validate references by ensuring resources targeted by `before`, `notify`, `require`, and/or `subscribe` parameters also exist in the catalog.
12
+
13
+ Consider the following Puppet code:
14
+
15
+ ```
16
+ file { '/usr/local/bin/some-script.sh':
17
+ source => 'puppet:///modules/test/usr/local/bin/some-script.sh',
18
+ notify => Exec['execute /usr/local/bin/some-script.sh'],
19
+ }
20
+ ```
21
+
22
+ The catalog for this code would build, whether or not the `exec { 'execute /usr/local/bin/some-script.sh': ... }` resource was part of the catalog. However, when the catalog is applied on the Puppet agent, it would fail if this resource is missing.
23
+
24
+ With the `--validate-references` command line flag (or the `settings[:validate_references]` [configuration setting](/doc/configuration.md)), you can instruct `octocatalog-diff` to confirm that any resource targeted by a `before`, `notify`, `require`, and `subscribe` parameter actually exists. If the resource is missing from the catalog, an error will be raised, just as if the catalog failed to compile.
25
+
26
+ The command line argument is demonstrated here:
27
+
28
+ ```
29
+ # Validate all references: before,notify,require,subscribe
30
+ octocatalog-diff ... --validate-references before,notify,require,subscribe
31
+
32
+ # Validate some references: only before and require
33
+ octocatalog-diff ... --validate-references before,require
34
+
35
+ # Validate no references
36
+ octocatalog-diff ... --no-validate-references
37
+ ```
38
+
39
+ By default, no references are validated.
40
+
41
+ Note as well, when using `octocatalog-diff` to compare two catalogs, the references in the "from" catalog are not checked. The reason for this design decision is as follows: the "from" catalog is generally what is considered to be stable and is perhaps already deployed, so it adds no value (and perhaps inhibits the ability to develop further) if `octocatalog-diff` fails just because references in the "from" catalog are broken.
@@ -0,0 +1,93 @@
1
+ # Environment setup
2
+
3
+ When building a catalog, the default behavior of `octocatalog-diff` is to:
4
+
5
+ 1. Create a temporary directory
6
+ 2. Create a symlink from `<temporary directory>/environments/production` to the checkout of your code
7
+ 3. Run Puppet using `environment=production`
8
+
9
+ If you are using environment names to control the behavior of Puppet, this default behavior may not be suitable. In that case you can invoke the alternate behavior: preserving environments.
10
+
11
+ ## Command line options
12
+
13
+ ### Preserving the environments
14
+
15
+ When you supply the command line argument `--preserve-environments` (or set `settings[:preserve_environments] = true` in your [configuration file](/doc/configuration.md)), `octocatalog-diff` will instead do the following:
16
+
17
+ 1. Create a temporary directory
18
+ 2. Create the following symlinks from `<temporary directory>` to the corresponding directories in the checkout of your code:
19
+
20
+ - `environments`
21
+ - `manifests`
22
+ - `modules`
23
+
24
+ 3. Run Puppet using an environment you specify via the command line
25
+
26
+ Note that you must have set `--preserve-environments` in order for the `--environment` and/or `--create-symlinks` options (described below) to have any effect.
27
+
28
+ ### Changing the environment
29
+
30
+ If you wish to use an environment name other than `production` you can use the `--environment <environment_name>` command line option. This will set the environment for both the `to` and `from` compiles.
31
+
32
+ ```
33
+ octocatalog-diff ... --preserve-environments --environment some-env-name
34
+ ```
35
+
36
+ If you need to specify different environments for the `to` and `from` compiles, you can use `--to-environment <environment_name>` and `--from-environment <environment_name>`.
37
+
38
+ ```
39
+ octocatalog-diff ... --preserve-environments --to-environment first-environment --from-environment second-environment
40
+ ```
41
+
42
+ ### Controlling symlinks that are created
43
+
44
+ Within the temporary directory, the `environments` symlink will always be created.
45
+
46
+ By default, `manifests` and `modules` will also be created from the temporary directory to the corresponding directories in your Puppet code base. If you need to customize the symlinks that are created, you can use the `--create-symlinks <dir1>,<dir2>,...` to list the symlinks that you need.
47
+
48
+ For example, if you have some code stored in a directory called `modules` and more code stored in a directory called `site`, you could do the following to create the symlinks as desired:
49
+
50
+ ```
51
+ octocatalog-diff ... --preserve-environments --create-symlinks manifests,modules,site
52
+ ```
53
+
54
+ ## Examples
55
+
56
+ Consider that your Puppet code base is organized as follows:
57
+
58
+ ```
59
+ - /opt/puppet
60
+ - environments
61
+ - old
62
+ - environment.conf
63
+ - manifests
64
+ - site.pp
65
+ - modules
66
+ - module_zero
67
+ - new
68
+ - environment.conf
69
+ - manifests
70
+ - site.pp
71
+ - modules
72
+ - module_zero
73
+ - modules
74
+ - module_one
75
+ - module_two
76
+ - site
77
+ - module_three
78
+ - module_four
79
+ ```
80
+
81
+ To calculate the difference between the "old" and "new" environment, you could use:
82
+
83
+ ```
84
+ octocatalog-diff \
85
+ --bootstrapped-from-dir /opt/puppet \
86
+ --bootstrapped-to-dir /opt/puppet \
87
+ --preserve-environments \
88
+ --from-environment old \
89
+ --to-environment new \
90
+ --create-symlinks modules,site
91
+ ```
92
+
93
+ (Note that `--bootstrapped-from-dir` and `--bootstrapped-to-dir` are used to specify the directory path to your code, and `-t` and `-f` are not used. That's because the difference in the catalog is derived from the environment used, and not the branch from a git repository.)
@@ -37,3 +37,5 @@ bin/octocatalog-diff --hiera-config hiera.yaml --hiera-path-strip /etc/puppetlab
37
37
  :yaml:
38
38
  :datadir: /var/tmp/puppet-compile-dir-92347829847/environments/%{environment}/hieradata
39
39
  ```
40
+
41
+ :warning: Be sure that you do NOT include a trailing slash on `--hiera-path-strip` or `settings[:hiera_path_strip]`.
@@ -21,6 +21,8 @@ See also:
21
21
  - [Overriding facts](/doc/advanced-override-facts.md)
22
22
  - [Puppet Enterprise node classification service](/doc/advanced-pe-enc.md)
23
23
  - [Using `octocatalog-diff` without git](/doc/advanced-using-without-git.md)
24
+ - [Catalog validation](/doc/advanced-catalog-validation.md)
25
+ - [Environment setup](/doc/advanced-environment.md)
24
26
 
25
27
  ### Controlling output
26
28
 
@@ -67,3 +67,37 @@ For example, when compiling the catalog for `some-node.github.net`, Puppet will
67
67
  ```
68
68
 
69
69
  Sometimes the ENC script requires credentials or makes other assumptions about the system on which it is running. To be able to run the ENC script on systems other than your Puppet master, you will need to ensure that any such credentials are supplied and other assumptions are met.
70
+
71
+ ## Environment
72
+
73
+ When the ENC is executed, the following environment variables are set to match the environment of the shell in which octocatalog-diff executes:
74
+
75
+ - `HOME`
76
+ - `PATH`
77
+ - `PWD` (set to the temporary directory as previously described)
78
+
79
+ No other environment variables are passed from the shell. If you wish to pass additional environment variables, you must explicitly list them with the `--pass-env-vars` CLI flag or `settings[:pass_env_vars]` array in your configuration file.
80
+
81
+ As an example, consider that your ENC is written in Python, and needs the `PYTHONPATH` variable set to `/usr/local/lib/python-custom`. Even if this environment variable is set when octocatalog-diff is run, it will not be available to the ENC script. You may pass the variable via the command line:
82
+
83
+ ```
84
+ octocatalog-diff --pass-env-vars PYTHONPATH ...
85
+ ```
86
+
87
+ Or you may specify it in your configuration file:
88
+
89
+ ```
90
+ settings[:pass_env_vars] = [ 'PYTHONPATH' ]
91
+ ```
92
+
93
+ If you wish to specify multiple environment variables to pass:
94
+
95
+ ```
96
+ octocatalog-diff --pass-env-vars PYTHONPATH,SECONDVAR,THIRDVAR ...
97
+ ```
98
+
99
+ or
100
+
101
+ ```
102
+ settings[:pass_env_vars] = [ 'PYTHONPATH', 'SECONDVAR', 'THIRDVAR' ]
103
+ ```
@@ -2,8 +2,47 @@
2
2
 
3
3
  The project maintainers are responsible for bumping the version number, regenerating auto-generated documentation, tagging the release, and uploading to rubygems.
4
4
 
5
- 0. Ensure that all changes have been merged to master.
5
+ ## Local testing
6
+
7
+ To test the new version of `octocatalog-diff` in the Puppet repository:
8
+
9
+ 0. In the Puppet checkout, start a new branch based off master.
10
+ 0. In the `octocatalog-diff` checkout:
11
+ - Ensure that the desired branch is checked out.
12
+ - Choose a unique internal version number which has never been used in CI. A good guideline is that if you're planning to release a version `0.6.0` then for these tests, use `0.6.0a`, `0.6.0b`, ...
13
+ - Build the gem using your internal version number:
14
+
15
+ ```
16
+ OCTOCATALOG_DIFF_VERSION=0.6.0a rake gem:force-build
17
+ ```
18
+ - Run the task to install the gem into your Puppet checkout:
19
+
20
+ ```
21
+ OCTOCATALOG_DIFF_VERSION=0.6.0a rake gem:localinstall
22
+ ```
23
+
24
+ 0. Back in the Puppet checkout, ensure that the changes are as expected (updates to Gemfile / Gemfile.lock, addition of new gem). Push the change and build appropriate CI job(s) to validate the changes.
25
+
26
+ ## Merging
27
+
6
28
  0. If necessary, complete a Pull Request to update the [version file](/.version).
29
+ 0. If necessary, auto-generate the build documentation.
30
+
31
+ ```
32
+ rake doc:build
33
+ ```
34
+
35
+ 0. Ensure that CI tests are all passing.
36
+ 0. Merge and delete the branch.
37
+
38
+ ## Releasing
39
+
40
+ Generally, a new release will correspond to a merge to master of one or more Pull Requests.
41
+
42
+ 0. Ensure that all changes associated with the release have been merged to master.
43
+ - Merge all Pull Requests associated with release.
44
+ - If necessary, complete a Pull Request to update the [change log](/doc/CHANGELOG.md).
45
+ - If necessary (for significant changes), complete a Pull Request to update the top-level README file.
7
46
  0. Ensure the the master branch is checked out on your system.
8
47
  0. Run the release procedure:
9
48
 
@@ -13,7 +52,6 @@ The project maintainers are responsible for bumping the version number, regenera
13
52
 
14
53
  This rake task handles the following:
15
54
 
16
- - Auto-generates the [options reference](/doc/optionsref.md) (`rake doc:build`)
17
55
  - Build the gem file (`rake gem:build`)
18
56
  - Tag the release in the repository (`rake gem:tag`)
19
57
  - Upload the gem file to rubygems (`rake gem:push`)
@@ -0,0 +1,62 @@
1
+ # Running octocatalog-diff from a branch
2
+
3
+ When we are assisting with troubleshooting, or implementing a feature you've requested, we may ask you to run `octocatalog-diff` from a non-master branch to try it out.
4
+
5
+ This document is intended for people who may not be familiar with git, GitHub, and/or ruby. If you already know how to do this in another way, feel free!
6
+
7
+ ## Installation
8
+
9
+ 1. Determine the branch name. If there's an open Pull Request, you can see the branch name near the top of the page.
10
+
11
+ ![Pull Request branch](/doc/images/pull-request-identify-branch.png)
12
+
13
+ 2. Clone the `octocatalog-diff` repository in your home directory. From the command line:
14
+
15
+ ```
16
+ cd $HOME
17
+ git clone https://github.com/github/octocatalog-diff.git
18
+ ```
19
+
20
+ 3. Change into the directory created by your checkout:
21
+
22
+ ```
23
+ cd $HOME/octocatalog-diff
24
+ ```
25
+
26
+ 4. Check out the branch you wish to use, filling in the branch name you determined in the first step:
27
+
28
+ ```
29
+ git checkout BRANCH_NAME_FROM_STEP_1
30
+ ```
31
+
32
+ 5. Bootstrap the repository to pull in dependencies:
33
+
34
+ ```
35
+ ./script/bootstrap
36
+ ```
37
+
38
+ 6. Optional but recommended - run the test suite:
39
+
40
+ ```
41
+ rake
42
+ ```
43
+
44
+ ## Use
45
+
46
+ Now that you have `octocatalog-diff` checked out and bootstrapped, it's time to use it.
47
+
48
+ We've created a wrapper script to make this easier for you.
49
+
50
+ 1. Change directories to the location where you ordinarily run `octocatalog-diff` (for example: in your Puppet repository).
51
+
52
+ ```
53
+ cd /etc/puppetlabs/code
54
+ ```
55
+
56
+ 2. Run the `script/octocatalog-diff-wrapper` script from *this* checkout. For example, if you checked out `octocatalog-diff` to your home directory, you could use:
57
+
58
+ ```
59
+ $HOME/octocatalog-diff/script/octocatalog-diff-wrapper <options>
60
+ ```
61
+
62
+ :warning: Note: If you are requesting our help, please use the debug option (`-d`) to display debugging information.
@@ -47,3 +47,9 @@ To install from source, you'll need a git client and internet access.
47
47
  Note: If tests fail on your machine with a clean checkout of the master branch, we would definitely appreciate if you would report it. Please [open an issue](https://github.com/github/octocatalog-diff/issues/new) with the output and some information about your system (e.g. OS, ruby version, etc.) to let us know.
48
48
 
49
49
  Once the code is downloaded and bootstrapped, please proceed to [Configuration](/doc/configuration.md).
50
+
51
+ ## Running from an alternate branch
52
+
53
+ We have prepared specific instructions for running `octocatalog-diff` from a non-master branch, for testing changes that may be requested by the developers.
54
+
55
+ - [Running octocatalog-diff from a branch](/doc/dev/run-from-branch.md)
@@ -47,6 +47,8 @@ Usage: octocatalog-diff [command line options]
47
47
  --ignore-attr "attr1,attr2,..."
48
48
  Attributes to ignore
49
49
  --[no-]display-source Show source file and line for each difference
50
+ --[no-]validate-references "before,require,subscribe,notify"
51
+ References to validate
50
52
  --[no-]compare-file-text Compare text, not source location, of file resources
51
53
  --[no-]storeconfigs Enable integration with puppetdb for collected resources
52
54
  --retry-failed-catalog N Retry building a failed catalog N times
@@ -64,28 +66,29 @@ Usage: octocatalog-diff [command line options]
64
66
  --[no-]display-datatype-changes
65
67
  Display changes in data type even when strings match
66
68
  --[no-]catalog-only Only compile the catalog for the "to" branch but do not diff
69
+ --[no-]from-puppetdb Pull "from" catalog from PuppetDB instead of compiling
70
+ --[no-]parallel Enable or disable parallel processing
67
71
  --puppet-binary STRING Full path to puppet binary globally
68
72
  --to-puppet-binary STRING Full path to puppet binary for the to branch
69
73
  --from-puppet-binary STRING Full path to puppet binary for the from branch
70
- --[no-]from-puppetdb Pull "from" catalog from PuppetDB instead of compiling
71
- --[no-]parallel Enable or disable parallel processing
74
+ --facts-terminus STRING Facts terminus: one of yaml, facter
72
75
  --puppetdb-ssl-ca FILENAME CA certificate that signed the PuppetDB certificate
76
+ --puppetdb-ssl-client-password PASSWORD
77
+ Password for SSL client key to connect to PuppetDB
73
78
  --puppetdb-ssl-client-cert FILENAME
74
79
  SSL client certificate to connect to PuppetDB
80
+ --puppetdb-ssl-client-key FILENAME
81
+ SSL client key to connect to PuppetDB
75
82
  --puppetdb-ssl-client-password-file FILENAME
76
83
  Read password for SSL client key from a file
77
- --puppetdb-ssl-client-password PASSWORD
78
- Password for SSL client key to connect to PuppetDB
79
- --facts-terminus STRING Facts terminus: one of yaml, facter
80
84
  --puppetdb-url URL PuppetDB base URL
81
- --puppetdb-ssl-client-key FILENAME
82
- SSL client key to connect to PuppetDB
83
- --puppet-master-ssl-client-key STRING
84
- Full path to key file for SSL client auth to Puppet Master globally
85
- --to-puppet-master-ssl-client-key STRING
86
- Full path to key file for SSL client auth to Puppet Master for the to branch
87
- --from-puppet-master-ssl-client-key STRING
88
- Full path to key file for SSL client auth to Puppet Master for the from branch
85
+ --puppetdb-api-version N Version of PuppetDB API (3 or 4)
86
+ --fact-override STRING1[,STRING2[,...]]
87
+ Override fact globally
88
+ --to-fact-override STRING1[,STRING2[,...]]
89
+ Override fact for the to branch
90
+ --from-fact-override STRING1[,STRING2[,...]]
91
+ Override fact for the from branch
89
92
  --puppet-master STRING Hostname or Hostname:PortNumber for Puppet Master globally
90
93
  --to-puppet-master STRING Hostname or Hostname:PortNumber for Puppet Master for the to branch
91
94
  --from-puppet-master STRING Hostname or Hostname:PortNumber for Puppet Master for the from branch
@@ -107,15 +110,15 @@ Usage: octocatalog-diff [command line options]
107
110
  Full path to certificate file for SSL client auth to Puppet Master for the to branch
108
111
  --from-puppet-master-ssl-client-cert STRING
109
112
  Full path to certificate file for SSL client auth to Puppet Master for the from branch
110
- --fact-override STRING1[,STRING2[,...]]
111
- Override fact globally
112
- --to-fact-override STRING1[,STRING2[,...]]
113
- Override fact for the to branch
114
- --from-fact-override STRING1[,STRING2[,...]]
115
- Override fact for the from branch
113
+ --puppet-master-ssl-client-key STRING
114
+ Full path to key file for SSL client auth to Puppet Master globally
115
+ --to-puppet-master-ssl-client-key STRING
116
+ Full path to key file for SSL client auth to Puppet Master for the to branch
117
+ --from-puppet-master-ssl-client-key STRING
118
+ Full path to key file for SSL client auth to Puppet Master for the from branch
116
119
  --pe-enc-url URL Base URL for Puppet Enterprise ENC endpoint
117
- --pe-enc-token-file PATH Path containing token for PE node classifier, relative or absolute
118
120
  --pe-enc-token TOKEN Token to access the Puppet Enterprise ENC API
121
+ --pe-enc-token-file PATH Path containing token for PE node classifier, relative or absolute
119
122
  --pe-enc-ssl-ca FILENAME CA certificate that signed the ENC API certificate
120
123
  --pe-enc-ssl-client-cert FILENAME
121
124
  SSL client certificate to connect to PE ENC
@@ -124,10 +127,26 @@ Usage: octocatalog-diff [command line options]
124
127
  --no-ignore-tags Disable ignoring based on tags
125
128
  --ignore-tags STRING1[,STRING2[,...]]
126
129
  Specify tags to ignore
127
- --[no-]suppress-absent-file-details
128
- Suppress certain attributes of absent files
130
+ --[no-]preserve-environments Enable or disable environment preservation
131
+ --environment STRING Environment for catalog compilation globally
132
+ --to-environment STRING Environment for catalog compilation for the to branch
133
+ --from-environment STRING Environment for catalog compilation for the from branch
134
+ --create-symlinks STRING1[,STRING2[,...]]
135
+ Symlinks to create globally
136
+ --to-create-symlinks STRING1[,STRING2[,...]]
137
+ Symlinks to create for the to branch
138
+ --from-create-symlinks STRING1[,STRING2[,...]]
139
+ Symlinks to create for the from branch
140
+ --command-line STRING1[,STRING2[,...]]
141
+ Command line arguments globally
142
+ --to-command-line STRING1[,STRING2[,...]]
143
+ Command line arguments for the to branch
144
+ --from-command-line STRING1[,STRING2[,...]]
145
+ Command line arguments for the from branch
129
146
  --pass-env-vars VAR1[,VAR2[,...]]
130
147
  Environment variables to pass
148
+ --[no-]suppress-absent-file-details
149
+ Suppress certain attributes of absent files
131
150
 
132
151
  ```
133
152
 
@@ -828,6 +847,34 @@ https://your-pe-console-server:4433/classifier-api (<a href="../lib/octocatalog-
828
847
  </td>
829
848
  </tr>
830
849
 
850
+ <tr>
851
+ <td valign=top>
852
+ <pre><code>--preserve-environments
853
+ --no-preserve-environments </code></pre>
854
+ </td>
855
+ <td valign=top>
856
+ Enable or disable environment preservation
857
+ </td>
858
+ <td valign=top>
859
+ Preserve the `environments` directory from the repository when compiling the catalog. Likely
860
+ requires some combination of `--to-environment`, `--from-environment`, and/or `--create-symlinks`
861
+ to work correctly. (<a href="../lib/octocatalog-diff/catalog-diff/cli/options/preserve_environments.rb">preserve_environments.rb</a>)
862
+ </td>
863
+ </tr>
864
+
865
+ <tr>
866
+ <td valign=top>
867
+ <pre><code>--puppetdb-api-version N</code></pre>
868
+ </td>
869
+ <td valign=top>
870
+ Version of PuppetDB API (3 or 4)
871
+ </td>
872
+ <td valign=top>
873
+ Specify the API version to use for the PuppetDB. The current values supported are '3' or '4', and '4' is
874
+ the default. (<a href="../lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_api_version.rb">puppetdb_api_version.rb</a>)
875
+ </td>
876
+ </tr>
877
+
831
878
  <tr>
832
879
  <td valign=top>
833
880
  <pre><code>--puppetdb-ssl-ca FILENAME</code></pre>
@@ -1014,4 +1061,19 @@ These files must exist and be in Puppet catalog format. (<a href="../lib/octocat
1014
1061
  </td>
1015
1062
  </tr>
1016
1063
 
1064
+ <tr>
1065
+ <td valign=top>
1066
+ <pre><code>--validate-references
1067
+ --no-validate-references </code></pre>
1068
+ </td>
1069
+ <td valign=top>
1070
+ References to validate
1071
+ </td>
1072
+ <td valign=top>
1073
+ Confirm that each `before`, `require`, `subscribe`, and/or `notify` points to a valid
1074
+ resource in the catalog. This value should be specified as an array of which of these
1075
+ parameters are to be checked. (<a href="../lib/octocatalog-diff/catalog-diff/cli/options/validate_references.rb">validate_references.rb</a>)
1076
+ </td>
1077
+ </tr>
1078
+
1017
1079
  </table>