octocatalog-diff 1.5.4 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.version +1 -1
- data/README.md +3 -3
- data/doc/CHANGELOG.md +10 -0
- data/doc/limitations.md +9 -9
- data/lib/octocatalog-diff/catalog-diff/differ.rb +13 -2
- data/lib/octocatalog-diff/catalog-util/fileresources.rb +1 -1
- data/lib/octocatalog-diff/util/parallel.rb +20 -16
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 90eb139ff8685aa8906b164f1d3bc869efce0a9a8b0711c4f5b575bcd7d9d18f
|
4
|
+
data.tar.gz: 92b5fcd9820cff4e19e02d9748774627a3569d4b1775c321a15bfc8d5fb19bda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab5c43c7a9de9d437ce4249b7cbe8b4d07b1cfc5b858deb4b26a2f1021245b49279e02ddc53f412e7d17f58bc27c461921f614650c20055cd11442f8b827e42c
|
7
|
+
data.tar.gz: caa52478aa06d0b51ea00686281d21e808afd1c78330fb17a53492c092836f5000365d2ae1880f0aac5f5577c6ba7d9d27708ecd6f4d6c8f6a0440dd4243b398
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.6.0
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# octocatalog-diff
|
1
|
+
# octocatalog-diff ![CI](https://github.com/github/octocatalog-diff/workflows/CI/badge.svg)
|
2
2
|
|
3
3
|
#### Compile Puppet catalogs from 2 branches, versions, etc., and compare them <img src="/doc/images/octocatolog-diff-logo.png" align="right" height=126 width=240>
|
4
4
|
|
@@ -81,6 +81,6 @@ If you have a problem or suggestion, please [open an issue](https://github.com/g
|
|
81
81
|
|
82
82
|
It requires 3rd party ruby gems found [here](/vendor/cache). It also includes portions of other open source projects [here](/lib/octocatalog-diff/external/pson), [here](/spec/octocatalog-diff/fixtures/repos/default/modules/stdlib), [here](/spec/octocatalog-diff/support/httparty) and [here](/spec/octocatalog-diff/tests/external/pson). All 3rd party code and required gems are licensed either as MIT or Apache 2.0.
|
83
83
|
|
84
|
-
## Authors
|
84
|
+
## Authors / Owners
|
85
85
|
|
86
|
-
`octocatalog-diff` was designed and authored by [Kevin Paulisse](https://github.com/kpaulisse)
|
86
|
+
`octocatalog-diff` was originally designed and authored by [Kevin Paulisse](https://github.com/kpaulisse). It is now maintained by the Site Reliability Engineering team at GitHub.
|
data/doc/CHANGELOG.md
CHANGED
@@ -8,6 +8,16 @@
|
|
8
8
|
</tr>
|
9
9
|
</thead><tbody>
|
10
10
|
|
11
|
+
<tr valign=top>
|
12
|
+
<td>1.6.0</td>
|
13
|
+
<td>2019-10-31</td>
|
14
|
+
<li><a href="https://github.com/github/octocatalog-diff/pull/216">#216</a>: (Enhancement) Hide sensitive parameters</li>
|
15
|
+
<li><a href="https://github.com/github/octocatalog-diff/pull/204">#204</a>: (Enhancement) Add glob support for modulepath</li>
|
16
|
+
<li><a href="https://github.com/github/octocatalog-diff/pull/206">#206</a>: (Bug Fix) Fix multi-node list with parallel mode</li>
|
17
|
+
<li><a href="https://github.com/github/octocatalog-diff/pull/215">#215</a>: (Bug Fix) Add Support for Hashdiff 1.0.0</li>
|
18
|
+
</td>
|
19
|
+
</tr>
|
20
|
+
|
11
21
|
<tr valign=top>
|
12
22
|
<td>1.5.4</td>
|
13
23
|
<td>2018-12-11</td>
|
data/doc/limitations.md
CHANGED
@@ -2,23 +2,23 @@
|
|
2
2
|
|
3
3
|
Testing of Puppet catalogs is faster than running the agent, but you need to be careful of the following limitations:
|
4
4
|
|
5
|
-
|
5
|
+
1. Facts are not taken from a live agent run
|
6
6
|
|
7
|
-
|
7
|
+
octocatalog-diff by default uses the facts reported from a node's more recent Puppet run. If you have made changes to custom facts, catalog testing will **NOT** be an adequate test of whether your custom facts worked. (You can still use octocatalog-diff to help predict changes to nodes based on changes to facts, by overriding facts on the command line.)
|
8
8
|
|
9
|
-
|
9
|
+
1. Agents handle depenency ordering and implementation details
|
10
10
|
|
11
|
-
|
11
|
+
The catalog defines the state of the system, but it's up to the agent to determine how to bring the system to a point that matches the catalog. The agent is responsible for order of operations and actually making the change.
|
12
12
|
|
13
|
-
|
13
|
+
Two specific situations that catalog testing does **NOT** detect are:
|
14
14
|
|
15
|
-
|
15
|
+
- Dependency loops (e.g., you have made A require B, B require C, and C require A).
|
16
16
|
|
17
|
-
|
17
|
+
- Operations not supported by the provider. For example, assume that in your current Puppet manifests, you set the size of a file system to 100 GB. You change this in your new branch to 50 GB. octocatalog-diff will dutifully report this change to you. However, the agent will fail to make the change, because it is not possible to shrink a file system from 100 GB to 50 GB.
|
18
18
|
|
19
|
-
|
19
|
+
1. Changes in underlying providers may not be noticed
|
20
20
|
|
21
|
-
|
21
|
+
Consider that you are using a Puppet module that creates a file system. The current implementation of that module checks to see if *any* file system is present on the device, and creates a new file system there if no file system was present. You upgrade the module, and the new version checks to see if *the specified* file system is present on the device, and reformats the device with the specified file system (regardless of whether there was no file system or if there was an existing file system of a different type). There would be no catalog changes (hence octocatalog-diff would report nothing) because the catalog simply instructs the agent to create a file system of the specified type at the defined location. However, the actual implementation of those instructions has changed dramatically.
|
22
22
|
|
23
23
|
In general catalog testing is great for:
|
24
24
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'diffy'
|
4
|
+
require 'digest'
|
4
5
|
require 'hashdiff'
|
5
6
|
require 'json'
|
6
7
|
require 'set'
|
@@ -11,6 +12,8 @@ require_relative '../errors'
|
|
11
12
|
require_relative '../util/util'
|
12
13
|
require_relative 'filter'
|
13
14
|
|
15
|
+
HashDiff = Hashdiff unless defined? HashDiff
|
16
|
+
|
14
17
|
module OctocatalogDiff
|
15
18
|
module CatalogDiff
|
16
19
|
# Calculate the difference between two Puppet catalogs.
|
@@ -263,7 +266,7 @@ module OctocatalogDiff
|
|
263
266
|
|
264
267
|
# Handle parameters
|
265
268
|
if k == 'parameters'
|
266
|
-
cleansed_param = cleanse_parameters_hash(v)
|
269
|
+
cleansed_param = cleanse_parameters_hash(v, resource.fetch('sensitive_parameters', []))
|
267
270
|
hsh[k] = cleansed_param unless cleansed_param.nil? || cleansed_param.empty?
|
268
271
|
elsif k == 'tags'
|
269
272
|
# The order of tags is unimportant. Sort this array to avoid false diffs if order changes.
|
@@ -456,10 +459,18 @@ module OctocatalogDiff
|
|
456
459
|
|
457
460
|
# Cleanse parameters of filtered attributes.
|
458
461
|
# @param parameters_hash [Hash] Hash of parameters
|
462
|
+
# @param sensitive_parameters [Array] Array of sensitive parameters
|
459
463
|
# @return [Hash] Cleaned parameters hash (original input hash is not altered)
|
460
|
-
def cleanse_parameters_hash(parameters_hash)
|
464
|
+
def cleanse_parameters_hash(parameters_hash, sensitive_parameters)
|
461
465
|
result = parameters_hash.dup
|
462
466
|
|
467
|
+
# hides sensitive params. We still need to know if there's a going to
|
468
|
+
# be a diff, so we hash the value.
|
469
|
+
sensitive_parameters.each do |p|
|
470
|
+
md5 = Digest::MD5.hexdigest Marshal.dump(result[p])
|
471
|
+
result[p] = 'Sensitive [md5sum ' + md5 + ']'
|
472
|
+
end
|
473
|
+
|
463
474
|
# 'before' and 'require' handle internal Puppet ordering but do not affect what
|
464
475
|
# happens on the target machine. Don't consider these for the purpose of catalog diff.
|
465
476
|
result.delete('before')
|
@@ -129,22 +129,26 @@ module OctocatalogDiff
|
|
129
129
|
|
130
130
|
# Waiting for children and handling results
|
131
131
|
while pidmap.any?
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
132
|
+
pidmap.each do |pid|
|
133
|
+
status = Process.waitpid2(pid[0], Process::WNOHANG)
|
134
|
+
next if status.nil?
|
135
|
+
this_pid, exit_obj = status
|
136
|
+
next unless this_pid && pidmap.key?(this_pid)
|
137
|
+
index = pidmap[this_pid][:index]
|
138
|
+
exitstatus = exit_obj.exitstatus
|
139
|
+
raise "PID=#{this_pid} exited abnormally: #{exit_obj.inspect}" if exitstatus.nil?
|
140
|
+
raise "PID=#{this_pid} exited with status #{exitstatus}" unless exitstatus.zero?
|
141
|
+
|
142
|
+
input = File.read(File.join(ipc_tempdir, "#{this_pid}.dat"))
|
143
|
+
result[index] = Marshal.load(input) # rubocop:disable Security/MarshalLoad
|
144
|
+
time_delta = Time.now - pidmap[this_pid][:start_time]
|
145
|
+
pidmap.delete(this_pid)
|
146
|
+
|
147
|
+
logger.debug "PID=#{this_pid} completed in #{time_delta} seconds, #{input.length} bytes"
|
148
|
+
|
149
|
+
next if result[index].status
|
150
|
+
return result[index].exception
|
151
|
+
end
|
148
152
|
end
|
149
153
|
|
150
154
|
logger.debug 'All child processes completed with no exceptions raised'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octocatalog-diff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub, Inc.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: diffy
|
@@ -420,8 +420,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
420
420
|
- !ruby/object:Gem::Version
|
421
421
|
version: '0'
|
422
422
|
requirements: []
|
423
|
-
|
424
|
-
rubygems_version: 2.5.1
|
423
|
+
rubygems_version: 3.0.6
|
425
424
|
signing_key:
|
426
425
|
specification_version: 4
|
427
426
|
summary: Compile Puppet catalogs from 2 branches, versions, etc., and compare them.
|