record_store 6.5.0 → 6.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f5d50f38de714c7b8d6d316070fc9d6bca5ac4d40751629c3c565866178d628
4
- data.tar.gz: 14e3171ad53e5903404fcda9404bbfa109ec63db0c9253d8f3f7df76ee0e0ff1
3
+ metadata.gz: ad3694c8bdf89c030abd7d0b6e4dda77f6b0627783c11d5f96194b18c0be047d
4
+ data.tar.gz: 65a8d64e1a5feff467d78297d9ed299d409d2bad617829d99291f9ddd0557558
5
5
  SHA512:
6
- metadata.gz: ac87302ec7f2d9e1afcbac7af6ef340a7a6fdd7d503a2f941fb7e7f021a46eb3a2b071841a152b264ba1956c50aa45141853a3bfdda4e8101a5e226ddec595ac
7
- data.tar.gz: 17fdee4d8ca5b4e9692e6a3718cdbb143e076890b2752a9dd4516c110835edbd73208056c8be8bfc5d18b926d97050d33300a04c29639d77cdc1429b2caf41cc
6
+ metadata.gz: 257591b26a8b5b58d3752742d43be0acd79268ba0d3f69f2bf09b8469beefc70171900ba04f2b651ffd97d4bed82a49a42c65d002b3cb666e20178ba8d15864c
7
+ data.tar.gz: 8a605452495449a6a18e55ea57facb5d582977c21df5b74863fdda8ed185a9eafce3d788f6cab8b680bad019edf152c52548aa1dae7356700cf8026c1d5c5e1e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 6.5.1
4
+
5
+ Add support for a new parameter in the implicit records templates:
6
+
7
+ - `except_record`: the template will *NOT* generate the `injected_records` for records matching `except_record`, even if they matched `each_record`.
8
+
9
+ Also added support for regular expressions in the matching, using the already available `!ruby/regexp` text in a YAML value. The object loaded from the YAML
10
+ will be of `Regexp` type, and will thus be used to _match_ the value, instead of being identical only. This is supported in both `except_record` and
11
+ `each_record` fields.
12
+
13
+ ## 6.5.0
14
+
15
+ ...
16
+
3
17
  ## 6.4.0
4
18
 
5
19
  Add support for injecting implicit records into a zone based on a pre-configured template. Brief overview of template keys:
@@ -1,3 +1,3 @@
1
1
  module RecordStore
2
- VERSION = '6.5.0'.freeze
2
+ VERSION = '6.5.1'.freeze
3
3
  end
@@ -26,9 +26,14 @@ module RecordStore
26
26
  def from_file(filename:)
27
27
  filepath = template_filepath_for(filename: filename)
28
28
  template_file = File.read(filepath)
29
- filters_for_records_to_template = YAML.load(template_file).deep_symbolize_keys[:each_record]
30
29
 
31
- new(template: ERB.new(template_file), filters_for_records_to_template: filters_for_records_to_template)
30
+ template_file_yaml = YAML.load(template_file).deep_symbolize_keys
31
+ filters_for_records_to_template = template_file_yaml[:each_record]
32
+ filters_for_records_to_exclude = template_file_yaml[:except_record]
33
+
34
+ new(template: ERB.new(template_file),
35
+ filters_for_records_to_template: filters_for_records_to_template,
36
+ filters_for_records_to_exclude: filters_for_records_to_exclude)
32
37
  end
33
38
 
34
39
  private
@@ -38,9 +43,10 @@ module RecordStore
38
43
  end
39
44
  end
40
45
 
41
- def initialize(template:, filters_for_records_to_template:)
46
+ def initialize(template:, filters_for_records_to_template:, filters_for_records_to_exclude:)
42
47
  @template = template
43
48
  @filters_for_records_to_template = filters_for_records_to_template
49
+ @filters_for_records_to_exclude = filters_for_records_to_exclude
44
50
  end
45
51
 
46
52
  def generate_records_to_inject(current_records:)
@@ -61,7 +67,7 @@ module RecordStore
61
67
 
62
68
  private
63
69
 
64
- attr_reader :template, :filters_for_records_to_template
70
+ attr_reader :template, :filters_for_records_to_template, :filters_for_records_to_exclude
65
71
 
66
72
  def should_inject?(template_records:, current_records:)
67
73
  current_records.none? do |record|
@@ -72,12 +78,17 @@ module RecordStore
72
78
  end
73
79
 
74
80
  def should_template?(record:)
75
- filters_for_records_to_template.any? { |filter| record_match?(record: record, filter: filter) }
81
+ filters_for_records_to_template.any? { |filter| record_match?(record: record, filter: filter) } && \
82
+ filters_for_records_to_exclude.none? { |filter| record_match?(record: record, filter: filter) }
76
83
  end
77
84
 
78
85
  def record_match?(record:, filter:)
79
86
  filter.all? do |key, value|
80
- record.public_send(key) == value
87
+ if value.is_a?(Regexp)
88
+ value.match(record.public_send(key))
89
+ else
90
+ record.public_send(key) == value
91
+ end
81
92
  end
82
93
  end
83
94
 
@@ -2,6 +2,8 @@ each_record:
2
2
  - type: A
3
3
  fqdn: abc.123.com.
4
4
  - type: TXT
5
+ except_record:
6
+ - fqdn: !ruby/regexp /^_/
5
7
  conflict_with:
6
8
  - type: TXT
7
9
  fqdn: <%= record.fqdn %>.more.domain.com.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: record_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.5.0
4
+ version: 6.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-04 00:00:00.000000000 Z
12
+ date: 2021-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -417,7 +417,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
417
417
  - !ruby/object:Gem::Version
418
418
  version: '0'
419
419
  requirements: []
420
- rubygems_version: 3.2.17
420
+ rubygems_version: 3.2.20
421
421
  signing_key:
422
422
  specification_version: 4
423
423
  summary: Manage DNS using git