datadog_backup 3.2.0 → 3.2.1

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: c069dccdefa9573c4fcd1e0e49292813203455a7b76e670c156a47936aa82b32
4
- data.tar.gz: 17c9f91c0de0a2a3975525c01f843f30bba77b43676c903a02472a1c576953ca
3
+ metadata.gz: 2e3e8528c064d05b09bd31080a7bcab7c77fcca8dde46949cf8c62a7702f2af1
4
+ data.tar.gz: 24c57007224fcf546b5a886e4b9f2a78f76b2a63fd2c64067ae2454192919848
5
5
  SHA512:
6
- metadata.gz: 7200fc88e53d944655028f91455d015a788ab4529f6cf21739dc23631ba168945d664bbcf9c000b81ce44be85ce33f2c6d964a1aa40625cbf93a601dec5d0df1
7
- data.tar.gz: b570dc952f7a9b93817970a2f897b005c6e81c1abb2d99988c32567cc7380a6042af3fb8a6e0e8d858a4d4447d681da762e389e434ee51446e7427b0d6864181
6
+ metadata.gz: d5180a6ba1f92f5db842e88d337878eacd0bafe114fbbb8752153b85f7c47f682be3bdd529b694294cc5523fe4c94274a7ee78d15fc4798b327598fb7710303b
7
+ data.tar.gz: f4ccccd735136f06f92cc71f1df0176e5fa626fd36f5e60f4bc88ef93f9fcf31f8d840c523e1e70f08195faf8d32e8522fea3665e9b6f1efe280cf8b214331a9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [3.2.1](https://github.com/scribd/datadog_backup/compare/v3.2.0...v3.2.1) (2023-02-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update error handling for restore ([233b1b2](https://github.com/scribd/datadog_backup/commit/233b1b27d485e7502dd47ca01670cea0576e920d))
7
+
1
8
  # [3.2.0](https://github.com/scribd/datadog_backup/compare/v3.1.1...v3.2.0) (2023-02-10)
2
9
 
3
10
 
@@ -22,6 +22,15 @@ module DatadogBackup
22
22
  Concurrent::Promises.zip(*futures).value!
23
23
  end
24
24
 
25
+ def get_by_id(id)
26
+ begin
27
+ dashboard = except(get(id))
28
+ rescue Faraday::ResourceNotFound => e
29
+ dashboard = {}
30
+ end
31
+ except(dashboard)
32
+ end
33
+
25
34
  def initialize(options)
26
35
  super(options)
27
36
  @banlist = %w[modified_at url].freeze
@@ -110,9 +110,7 @@ module DatadogBackup
110
110
  body = load_from_file_by_id(id)
111
111
  begin
112
112
  update(id, body)
113
- rescue RuntimeError => e
114
- raise e.message unless e.message.include?('update failed with error 404')
115
-
113
+ rescue Faraday::ResourceNotFound => e
116
114
  create_newly(id, body)
117
115
  end
118
116
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatadogBackup
4
- VERSION = '3.2.0'
4
+ VERSION = '3.2.1'
5
5
  end
@@ -103,7 +103,7 @@ describe DatadogBackup::Resources do
103
103
  allow(resources).to receive(:api_resource_name).and_return('api-resource-name-string')
104
104
  stubs.get('/api/api-version-string/api-resource-name-string/abc-123-def') { respond_with200({ 'test' => 'ok' }) }
105
105
  stubs.get('/api/api-version-string/api-resource-name-string/bad-123-id') do
106
- [404, {}, { 'error' => 'blahblah_not_found' }]
106
+ raise Faraday::ResourceNotFound
107
107
  end
108
108
  allow(resources).to receive(:load_from_file_by_id).and_return({ 'load' => 'ok' })
109
109
  end
@@ -126,7 +126,7 @@ describe DatadogBackup::Resources do
126
126
  before do
127
127
  allow(resources).to receive(:load_from_file_by_id).and_return({ 'load' => 'ok' })
128
128
  stubs.put('/api/api-version-string/api-resource-name-string/bad-123-id') do
129
- [404, {}, { 'error' => 'id not found' }]
129
+ raise Faraday::ResourceNotFound
130
130
  end
131
131
  stubs.post('/api/api-version-string/api-resource-name-string', { 'load' => 'ok' }) do
132
132
  respond_with200({ 'id' => 'my-new-id' })
@@ -231,7 +231,7 @@ describe DatadogBackup::Synthetics do
231
231
 
232
232
  before do
233
233
  synthetics.write_file(synthetics.dump({ 'name' => 'restore-invalid-id', 'type' => 'api' }), synthetics.filename('restore-invalid-id'))
234
- stubs.put('/api/v1/synthetics/tests/api/restore-invalid-id') { [404, {}, ''] }
234
+ stubs.put('/api/v1/synthetics/tests/api/restore-invalid-id') { raise Faraday::ResourceNotFound }
235
235
  stubs.post('/api/v1/synthetics/tests/api') { respond_with200({ 'public_id' => 'restore-valid-id' }) }
236
236
  allow(synthetics).to receive(:create).and_call_original
237
237
  allow(synthetics).to receive(:all).and_return([api_test, browser_test, { 'public_id' => 'restore-valid-id', 'type' => 'api' }])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog_backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamran Farhadi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-02-10 00:00:00.000000000 Z
12
+ date: 2023-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: amazing_print