Skip to content

Commit 34aca05

Browse files
authored
Merge pull request #114 from github/kpaulisse-mega-merge
Release 1.2.0
2 parents 5379ab6 + 255b9c2 commit 34aca05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+677
-394
lines changed

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ Lint/EndAlignment:
5252
Style/FileName:
5353
Enabled: false
5454

55+
# Sometimes it's cleaner without this
56+
Style/Documentation:
57+
Enabled: false
58+
5559
# To fix later
5660
Style/PercentLiteralDelimiters:
5761
Enabled: false

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ script: "script/cibuild"
77
matrix:
88
include:
99
# Build with latest ruby
10-
- rvm: 2.3.1
10+
- rvm: 2.4.1
1111
env: RUBOCOP_TEST="true" RSPEC_TEST="true"
1212
# Build with older ruby versions
13+
- rvm: 2.3.4
14+
env: RUBOCOP_TEST="false" RSPEC_TEST="true"
1315
- rvm: 2.2
1416
env: RUBOCOP_TEST="false" RSPEC_TEST="true"
1517
- rvm: 2.1

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.0
1+
1.2.0

doc/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
</tr>
99
</thead><tbody>
1010
<tr valign=top>
11+
<td>1.2.0</td>
12+
<td>2017-05-18</td>
13+
<td>
14+
<li><a href="https://github.com/github/octocatalog-diff/pull/112">#112</a>: Split arguments added for ENC</li>
15+
<li><a href="https://github.com/github/octocatalog-diff/pull/113">#113</a>: (Enhancement) Override facts and ENC parameters using regular expressions</li>
16+
<li><a href="https://github.com/github/octocatalog-diff/pull/103">#111</a>: Simplify parallel processing to solve some intermittent failures</li>
17+
<li><a href="https://github.com/github/octocatalog-diff/pull/110">#110</a>: Ruby 2.4 compatibility</li>
18+
</td>
19+
</tr>
20+
<tr valign=top>
1121
<td>1.1.0</td>
1222
<td>2017-05-08</td>
1323
<td>

doc/advanced-override-facts.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,16 @@ The following data types in parentheses are supported:
6565
| `(json)` | Treat the input as a JSON string (calls `JSON.parse` in ruby) |
6666
| `(boolean)` | Treat the input as a boolean -- it must be `true` or `false`, case-insensitive |
6767
| `(nil)` | Ignore any characters after `(nil)` and deletes the fact if the fact exists |
68+
69+
## Regular expressions
70+
71+
If you wish to match multiple facts by pattern, specify the regular expression in place of the key name. For example:
72+
73+
```
74+
octocatalog-diff -n some-node.example.com -f master -t master \
75+
--to-fact-override /^ipaddress/=10.11.12.13
76+
```
77+
78+
In this example, `$::ipaddress`, `$::ipaddress_eth0`, `$::ipaddress_bond0`, and any other facts starting with "ipaddress" would be overridden. However, a fact named `$::additional_ipaddress` would not be overridden, because it does not match the regular expression.
79+
80+
Please note that you cannot *add* a fact with a regular expression -- when using regular expressions you can only modify or delete facts.

doc/dev/integration-tests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe 'whatever behavior' do
2222
# @result[:logs] is a String containing everything printed to STDERR (Logger)
2323
# @result[:output] is a String containing everything printed to STDOUT
2424
# @result[:diffs] is an Array of differences
25-
# @result[:exitcode] is a Fixnum representing the exit code: 0 = no changes, 1 = failure, 2 = success, with changes
25+
# @result[:exitcode] is an Integer representing the exit code: 0 = no changes, 1 = failure, 2 = success, with changes
2626
# @result[:exception] contains any exception that was thrown
2727
end
2828

@@ -46,7 +46,7 @@ describe 'whatever behavior' do
4646
# @result[:logs] is a String containing everything printed to STDERR (Logger)
4747
# @result[:output] is a String containing everything printed to STDOUT
4848
# @result[:diffs] is an Array of differences
49-
# @result[:exitcode] is a Fixnum representing the exit code: 0 = no changes, 1 = failure, 2 = success, with changes
49+
# @result[:exitcode] is an Integer representing the exit code: 0 = no changes, 1 = failure, 2 = success, with changes
5050
# @result[:exception] contains any exception that was thrown
5151
end
5252

doc/requirements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
To run `octocatalog-diff` you will need these basics:
44

5-
- Ruby 2.0 or higher
5+
- Ruby 2.0 through 2.4 (we test octocatalog-diff with Ruby 2.0, 2.1, 2.2, 2.3, and 2.4)
66
- Mac OS, Linux, or other Unix-line operating system (Windows is not supported)
77
- Ability to install gems, e.g. with [rbenv](https://github.com/rbenv/rbenv) or [rvm](https://rvm.io/), or root privileges to install into the system Ruby
8-
- Puppet agent for [Linux](https://docs.puppet.com/puppet/latest/reference/install_linux.html) or [Mac OS X](https://docs.puppet.com/puppet/latest/reference/install_osx.html), or installed as a gem
8+
- Puppet agent for [Linux](https://docs.puppet.com/puppet/latest/reference/install_linux.html) or [Mac OS X](https://docs.puppet.com/puppet/latest/reference/install_osx.html), or installed as a gem (we support Puppet 3.8.7 and all versions of Puppet 4.x)
99

1010
We recommend that you also have the following to get the most out of `octocatalog-diff`, but these are not absolute requirements:
1111

lib/octocatalog-diff/api/v1/override.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class Override
1313
# Constructor: Accepts a key and value.
1414
# @param input [Hash] Must contain :key and :value
1515
def initialize(input)
16-
@key = input.fetch(:key)
16+
key = input.fetch(:key)
17+
@key = key =~ %r{\A/(.+)/\Z} ? Regexp.new(Regexp.last_match(1)) : key
1718
@value = parsed_value(input.fetch(:value))
1819
end
1920

@@ -29,6 +30,7 @@ def self.create_from_input(input, key = nil)
2930
# If input is not a string, we can still construct the object if the key is given.
3031
# That input would come directly from code and not from the command line, since inputs
3132
# from the command line are always strings.
33+
# Also support regular expressions for the key name, if delimited by //.
3234
if key.nil? && input.is_a?(String)
3335
unless input.include?('=')
3436
raise ArgumentError, "Fact override '#{input}' is not in 'key=(data type)value' format"
@@ -72,9 +74,9 @@ def convert_to_data_type(datatype, value)
7274
return value if datatype == 'string'
7375
return parse_json(value) if datatype == 'json'
7476
return nil if datatype == 'nil'
75-
if datatype == 'fixnum'
77+
if datatype == 'fixnum' || datatype == 'integer'
7678
return Regexp.last_match(1).to_i if value =~ /^(-?\d+)$/
77-
raise ArgumentError, "Illegal fixnum '#{value}'"
79+
raise ArgumentError, "Illegal integer '#{value}'"
7880
end
7981
if datatype == 'float'
8082
return Regexp.last_match(1).to_f if value =~ /^(-?\d*\.\d+)$/

lib/octocatalog-diff/bootstrap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Bootstrap
1010
# @param options [Hash] Options hash:
1111
# :path [String] => Directory to bootstrap
1212
# :bootstrap_script [String] => Bootstrap script, relative to directory
13-
# @return [Hash] => [Fixnum] :status_code, [String] :output
13+
# @return [Hash] => [Integer] :status_code, [String] :output
1414
def self.bootstrap(options = {})
1515
# Options validation
1616
unless options[:path].is_a?(String)

lib/octocatalog-diff/catalog-diff/differ.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def hashdiff_initial(catalog1_in, catalog2_in)
530530

531531
# Added a new key that points to some kind of data structure that we know how
532532
# to handle.
533-
if obj[1] =~ /^(.+)\f([^\f]+)$/ && [String, Fixnum, Float, TrueClass, FalseClass, Array, Hash].include?(obj[2].class)
533+
if obj[1] =~ /^(.+)\f([^\f]+)$/ && [String, Integer, Float, TrueClass, FalseClass, Array, Hash].include?(obj[2].class)
534534
hashdiff_add_remove.add(obj[1])
535535
next
536536
end

0 commit comments

Comments
 (0)