record_store 5.8.0 → 5.9.0

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: 3b33376f7cc95cbaab9a9d6e1c7bc635085a91578709b78e498c7e3719eef07a
4
- data.tar.gz: 363acd2374cca032b28ea6dd4f9a6976176803f54f7cbad5a1206e5b0b7018bc
3
+ metadata.gz: 0de2b9654c8b2260778da756212d7e1e7a37d41044d001370f2ededcef00cec7
4
+ data.tar.gz: ceb08dc9a74484dd3645630901b5d13da249c0491f6244d065711977c74d557e
5
5
  SHA512:
6
- metadata.gz: d25cc0344334dbc59f1493a33568d660bdfee9797652f302f72aa0b8d8225daff4ab09216c5de2050475d75252a841af4dde39331b89389f426e5bd8391ded29
7
- data.tar.gz: 76431cfa62e96ce5a362ff129cd28aeec3f198f89749952ef643eeeb6e12a1ec3fe5bf8b64bfba4fcbc84400888acdd270dc44ee3d331afd0f573ecb69381f56
6
+ metadata.gz: 25757a3029ee3cf1c7a15aa342f59ea7943b0e865b21df2a2d7176f31af43fbfe6763d4f5a4da7012167e82a6e82b6cb27aa1210a53f11b4f30b629de5492fa4
7
+ data.tar.gz: 9e16174c5c7ea101b29cbb2b347f0917e02f7b70de86be0817b7f624b5607ad97218fa22f9d6c1dabf2408632fc9bbdf500ac6e95d970e22d65838f34c883765
@@ -1,6 +1,13 @@
1
1
  # CHANGELOG
2
+ ## 5.9.0
3
+ - add `--all` option for `record-store list` to list ignored records too [FEATURE]
4
+ - add `record-store info` command to list providers and delegation for zones [FEATURE]
5
+
6
+ ## 5.8.0
7
+ - support SSHFP record type [FEATURE]
8
+
2
9
  ## 5.7.4
3
- - NS1: changing the way long TXT records are processed (no more splitting to do on our side)
10
+ - NS1: changing the way long TXT records are processed (no more splitting to do on our side) [BUGFIX]
4
11
 
5
12
  ## 5.7.1
6
13
  - add API rate limit for NS1 provider [FEATURE]
data/README.md CHANGED
@@ -125,7 +125,7 @@ To add a new Provider, create a class inheriting `Provider` in [`lib/record_stor
125
125
 
126
126
  **Note**: _there's no need to wrap `Provider#apply_changeset` unless it's necessary to do something before/after making changes to a zone._
127
127
 
128
- Provider API interactions are tested with [VCR](https://github.com/vcr/vcr). To generate the fixtures, update [`test/dummy/secrets.json`](test/dummy/secrets.json) with valid credentials, run the test suite, and change the values back to stub credentials.
128
+ Provider API interactions are tested with [VCR](https://github.com/vcr/vcr). To generate the fixtures, update [`test/fixtures/config/dummy/secrets.json`](test/fixtures/config/dummy/secrets.json) with valid credentials, run the test suite, and change the values back to stub credentials.
129
129
 
130
130
  **Important**: _be sure to [filter sensitive data](https://github.com/Shopify/record_store/blob/1ec0d1410cf8bedf79bc63e8e4cdc7cdb0f1019b/test/test_helper.rb#L23-L56) from the fixtures or you're going to have a bad time._
131
131
 
@@ -193,7 +193,7 @@ For provider-specific records (e.g. `ALIAS`), create the record model in `lib/re
193
193
 
194
194
  #### Secrets
195
195
 
196
- When adding a new provider, be sure to update the `secrets.json` in [`template/secrets.json`](template/secrets.json) and [`test/dummy/secrets.json`](test/dummy/secrets.json) with the new provider and required fields for the API to work.
196
+ When adding a new provider, be sure to update the `secrets.json` in [`template/secrets.json`](template/secrets.json) and [`test/fixtures/config/dummy/secrets.json`](test/fixtures/config/dummy/secrets.json) with the new provider and required fields for the API to work.
197
197
 
198
198
 
199
199
  ### Test Changes on Providers
data/Rakefile CHANGED
@@ -6,6 +6,7 @@ require 'record_store'
6
6
 
7
7
  Rake::TestTask.new do |t|
8
8
  t.libs << "test"
9
+ t.warning = false
9
10
  t.test_files = FileList['test/**/*_test.rb']
10
11
  end
11
12
 
data/dev.yml CHANGED
@@ -15,7 +15,7 @@ commands:
15
15
  if [[ $# -eq 0 ]]; then
16
16
  bundle exec rake test
17
17
  else
18
- bundle exec ruby -Itest "$@"
18
+ bundle exec ruby -W0 -Itest "$@"
19
19
  fi
20
20
  style:
21
21
  syntax: ""
@@ -61,6 +61,7 @@ module RecordStore
61
61
  def config_path=(config_path)
62
62
  @config = @zones_path = @secrets_path = nil
63
63
  @config_path = config_path
64
+ Zone.reset
64
65
  end
65
66
 
66
67
  def config
@@ -32,11 +32,30 @@ module RecordStore
32
32
  end
33
33
  end
34
34
 
35
+ desc 'info', 'Show information about zones under management'
36
+ option :delegation, desc: 'Include delegation', aliases: '-d', type: :boolean, default: false
37
+ def info
38
+ Zone.each do |name, zone|
39
+ puts "\n"
40
+ puts "Zone: #{name}"
41
+ puts "Providers:"
42
+ zone.config.providers.each { |p| puts "- #{p}" }
43
+ if (delegation = zone.fetch_authority)
44
+ puts "Authoritative nameservers:"
45
+ delegation.each { |d| puts "- #{d}" }
46
+ else
47
+ STDERR.puts "ERROR: Unable to determine delegation (#{name})"
48
+ end
49
+ end
50
+ end
51
+
35
52
  desc 'list', 'Lists out records in YAML zonefiles'
53
+ option :all, desc: 'Show all records', aliases: '-a', type: :boolean, default: false
36
54
  def list
37
55
  Zone.each do |name, zone|
38
56
  puts "Zone: #{name}"
39
- zone.records.each(&:log!)
57
+ records = options.fetch('all') ? zone.all : zone.records
58
+ records.each(&:log!)
40
59
  end
41
60
  end
42
61
 
@@ -1,7 +1,7 @@
1
1
  module RecordStore
2
2
  class Record::SPF < Record::TXT
3
3
  def initialize(record)
4
- STDERR.puts "SPF record type is deprecated (See RFC 7208 Section 14.1)"
4
+ $stderr.puts "SPF record type is deprecated (See RFC 7208 Section 14.1)"
5
5
  super
6
6
  end
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module RecordStore
2
- VERSION = '5.8.0'.freeze
2
+ VERSION = '5.9.0'.freeze
3
3
  end
@@ -86,6 +86,10 @@ module RecordStore
86
86
  @name.chomp('.')
87
87
  end
88
88
 
89
+ def all
90
+ @records
91
+ end
92
+
89
93
  def records
90
94
  @records_cache ||= Zone.filter_records(@records, config.ignore_patterns)
91
95
  end
@@ -108,8 +112,52 @@ module RecordStore
108
112
  self.class.write(name, config: config, records: records, **write_options)
109
113
  end
110
114
 
115
+ ROOT_SERVERS = %w(
116
+ a.root-servers.net
117
+ b.root-servers.net
118
+ c.root-servers.net
119
+ d.root-servers.net
120
+ e.root-servers.net
121
+ f.root-servers.net
122
+ g.root-servers.net
123
+ h.root-servers.net
124
+ i.root-servers.net
125
+ j.root-servers.net
126
+ k.root-servers.net
127
+ l.root-servers.net
128
+ m.root-servers.net
129
+ )
130
+
131
+ def fetch_authority(nameserver = ROOT_SERVERS.sample)
132
+ Resolv::DNS.open(nameserver: nameserver) do |resolv|
133
+ resolv.fetch_resource(name, Resolv::DNS::Resource::IN::SOA) do |reply, name|
134
+ break if reply.answer.any?
135
+
136
+ raise "No authority found (#{name})" unless reply.authority.any?
137
+
138
+ break extract_authority(reply)
139
+ end
140
+ end
141
+ end
142
+
111
143
  private
112
144
 
145
+ def extract_authority(reply)
146
+ authority = reply.authority.sample
147
+
148
+ if unrooted_name.casecmp?(authority.first.to_s)
149
+ build_authority(reply.authority)
150
+ else
151
+ fetch_authority(authority.last.name.to_s) || build_authority(reply.authority)
152
+ end
153
+ end
154
+
155
+ def build_authority(authority)
156
+ authority.map.with_index do |(name, ttl, data), index|
157
+ Record::NS.new(ttl: ttl, fqdn: name.to_s, nsdname: data.name.to_s, record_id: index)
158
+ end
159
+ end
160
+
113
161
  def build_records(records)
114
162
  records.map { |record| Record.build_from_yaml_definition(record) }
115
163
  end
@@ -14,6 +14,12 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = 'https://github.com/Shopify/record_store'
15
15
  spec.license = 'MIT'
16
16
 
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
19
+ else
20
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
21
+ end
22
+
17
23
  spec.files = %x(git ls-files -z).split("\x0").reject { |f| f.match(/^(test|DESIGN)/) }
18
24
  spec.executables = ['record-store']
19
25
  spec.require_paths = ['lib']
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: 5.8.0
4
+ version: 5.9.0
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: 2020-04-01 00:00:00.000000000 Z
12
+ date: 2020-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -394,7 +394,8 @@ files:
394
394
  homepage: https://github.com/Shopify/record_store
395
395
  licenses:
396
396
  - MIT
397
- metadata: {}
397
+ metadata:
398
+ allowed_push_host: https://rubygems.org
398
399
  post_install_message:
399
400
  rdoc_options: []
400
401
  require_paths:
@@ -410,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
410
411
  - !ruby/object:Gem::Version
411
412
  version: '0'
412
413
  requirements: []
413
- rubygems_version: 3.0.2
414
+ rubygems_version: 3.0.3
414
415
  signing_key:
415
416
  specification_version: 4
416
417
  summary: Manage DNS using git