record_store 6.5.2 → 6.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 444fc56b77f3f4a4142af2094365fea4bd2ac0a2a89d2f42574067c48f13a4e6
4
- data.tar.gz: 6d4bb6928c710a6d247be321e05b91ca929ac44d9ec15a2c99967e1f0a994d09
3
+ metadata.gz: 9af43560e4a84302824fb5b1abef5476bc0995e752d3960de068b45949b1d154
4
+ data.tar.gz: 4bc999da542a5484d7cf51a7bb652593c323fecac6d79d8e73ccbb62bd638ea0
5
5
  SHA512:
6
- metadata.gz: bf23882c66cfca5065bc4fb3308f39e5e441d085f2891297c254b9ff8f4af0b4b73a8a04cf806ad861f4cd6b075b429c20e74c73e5e6e0047a19b7b59ff4548f
7
- data.tar.gz: 187c5f2c80fc0dfeb6baa3583ed2fadf1dac26ac0e3d344fd3cb7ce6b378cda27cfaa382250db0da79f5cf9514cfd40a27d74f5fda41cfa266cb4f4388b5bec2
6
+ metadata.gz: d72d0a1bffea56a12070eab25df96cd120f00107779063ae651a141310b369764eeaa5fa8993d77c67f81e2f4e98e16641e6d8dacde4f35fa09be4a6fe08236e
7
+ data.tar.gz: e84f52373f10caa1fa464845a13a33383c7461392f69c88c17c032f9d91e8b96ffcd87fc9f1fc798478b05b2de2660629e2d6d4b89e232b405d80009676eac5b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 6.5.3
4
+ - Adds check for detecting shadowed records, used when a record being added to a zone in record-store will have no effect because it is shadowed by another record.
5
+
3
6
  ## 6.5.2
4
7
  - Ensure filters for implicit_records, `except_record` and `conflict_with`, are truly optional [BUGFIX]
5
8
 
@@ -7,7 +7,7 @@ module RecordStore
7
7
 
8
8
  def initialize(*args)
9
9
  super
10
- RecordStore.config_path = options.fetch('config', "#{Dir.pwd}/config.yml")
10
+ RecordStore.config_path = options.fetch('config', "#{Dir.pwd}/template/config.yml")
11
11
  end
12
12
 
13
13
  def self.exit_on_failure?
@@ -1,3 +1,3 @@
1
1
  module RecordStore
2
- VERSION = '6.5.2'.freeze
2
+ VERSION = '6.5.3'.freeze
3
3
  end
@@ -21,6 +21,7 @@ module RecordStore
21
21
  validate :validate_no_empty_non_terminal
22
22
  validate :validate_can_handle_alias_records
23
23
  validate :validate_no_duplicate_keys
24
+ validate :validate_zone_record_not_shadowed
24
25
 
25
26
  class << self
26
27
  def download(name, provider_name, **write_options)
@@ -62,7 +63,12 @@ module RecordStore
62
63
  current_zone = nil
63
64
  while zones.any?
64
65
  mutex.synchronize { current_zone = zones.shift }
65
- mutex.synchronize { modified_zones << current_zone } unless current_zone.unchanged?
66
+ break if current_zone.nil? # account for the race between `zones.any?` and `zones.shift`
67
+
68
+ # `unchanged?` is deliberately outside locked context since it's a bit CPU/time heavy
69
+ unless current_zone.unchanged?
70
+ mutex.synchronize { modified_zones << current_zone }
71
+ end
66
72
  end
67
73
  end
68
74
  end.each(&:join)
@@ -272,6 +278,26 @@ module RecordStore
272
278
  end
273
279
  end
274
280
 
281
+ def validate_zone_record_not_shadowed
282
+ nameserver_fqdns = records
283
+ .select { |record| record.is_a?(Record::NS) && name != record.fqdn }
284
+ .map { |record| record.fqdn.delete_suffix(".") }
285
+ .uniq
286
+
287
+ nameserver_fqdns.each do |ns_record|
288
+ selected_records = records.reject do |record|
289
+ record.is_a?(Record::NS) && \
290
+ record.fqdn.delete_suffix(".") == ns_record
291
+ end
292
+ selected_records.each do |record|
293
+ normalized_record = record.fqdn.delete_suffix(".")
294
+ next unless normalized_record.end_with?(".#{ns_record}") || normalized_record == ns_record
295
+ errors.add(:records, "Record #{record.fqdn} #{record.type} in Zone #{name} " \
296
+ "is shadowed by #{ns_record} and will be ignored")
297
+ end
298
+ end
299
+ end
300
+
275
301
  def validate_no_empty_non_terminal
276
302
  return unless config.empty_non_terminal_over_wildcard?
277
303
 
data/lib/record_store.rb CHANGED
@@ -44,6 +44,7 @@ module RecordStore
44
44
  class << self
45
45
  attr_writer :secrets_path
46
46
  attr_writer :zones_path
47
+ attr_writer :implicit_records_templates_path
47
48
 
48
49
  def secrets_path
49
50
  @secrets_path ||= File.expand_path(config.fetch('secrets_path'), File.dirname(config_path))
@@ -5,7 +5,7 @@ dynect.example.com:
5
5
  ignore_patterns:
6
6
  - type: NS
7
7
  fqdn: dynect.example.com.
8
- implicit_record_templates:
8
+ implicit_records_templates:
9
9
  - implicit_example.yml.erb
10
10
  records:
11
11
  - type: A
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.2
4
+ version: 6.5.3
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-08-10 00:00:00.000000000 Z
12
+ date: 2021-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor