do_snapshot 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/do_snapshot/adapter/abstract.rb +9 -0
- data/lib/do_snapshot/version.rb +1 -1
- data/spec/do_snapshot/adapter/abstract_spec.rb +20 -0
- data/spec/do_snapshot/adapter/digitalocean_spec.rb +3 -1
- data/spec/do_snapshot/adapter/digitalocean_v2_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccf04878066a2503d9f14a132ed4f38e337efeec
|
4
|
+
data.tar.gz: c3e81a395c37fdabe926dc709b2d00b4552e2dd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7819d4062fe0228c228877a33c2d4684a9b9584c3d512580e0b7e861665754174c89151697d04222e890c21d3a29f20c56791e075a0f58e9eee36cb22d1ef5c5
|
7
|
+
data.tar.gz: 63a9160783bcfef7ecad557ecfdfb7ed819947e1b42988e1954f312da178a45716c88ec3d37619b93a3421a6a146529aaed0fe726d9dc3bdd4fbb3d462350f3d
|
data/README.md
CHANGED
@@ -57,7 +57,11 @@ For **OSX** users ([Homebrew Tap](http://github.com/merqlove/homebrew-do-snapsho
|
|
57
57
|
$ brew tap merqlove/do-snapshot && brew install do_snapshot
|
58
58
|
|
59
59
|
$ do_snapshot -V
|
60
|
-
|
60
|
+
|
61
|
+
Standalone with one-liner:
|
62
|
+
|
63
|
+
$ wget https://assets.merqlove.ru.s3.amazonaws.com/do_snapshot/do_snapshot.tgz && sudo tar -xzf do_snapshot.tgz /usr/local/lib/ && sudo ln -s /usr/local/lib/do_snapshot/bin/do_snapshot /usr/local/bin/do_snapshot
|
64
|
+
|
61
65
|
Standalone pack for **Unix/Linux** users: [Download](https://assets.merqlove.ru.s3.amazonaws.com/do_snapshot/do_snapshot.tgz)
|
62
66
|
|
63
67
|
$ wget https://assets.merqlove.ru.s3.amazonaws.com/do_snapshot/do_snapshot.tgz # if not done.
|
@@ -45,6 +45,10 @@ module DoSnapshot
|
|
45
45
|
logger.debug message
|
46
46
|
time = Time.now
|
47
47
|
sleep(delay) until status_block.call(id, time)
|
48
|
+
rescue => e
|
49
|
+
logger.error e.message
|
50
|
+
e.backtrace.each { |t| logger.error t }
|
51
|
+
DoSnapshot::EventError.new(id)
|
48
52
|
end
|
49
53
|
|
50
54
|
# Waiting for event exit
|
@@ -88,6 +92,11 @@ module DoSnapshot
|
|
88
92
|
timeout? id, time, "Droplet id: #{id} shutdown event closed by timeout #{time}"
|
89
93
|
end
|
90
94
|
|
95
|
+
# This is stub for event status
|
96
|
+
def get_event_status(_id, _time)
|
97
|
+
true
|
98
|
+
end
|
99
|
+
|
91
100
|
# Looking for droplet status.
|
92
101
|
# Before snapshot we need to know that machine is powered off.
|
93
102
|
#
|
data/lib/do_snapshot/version.rb
CHANGED
@@ -19,4 +19,24 @@ RSpec.describe DoSnapshot::Adapter::Abstract do
|
|
19
19
|
it('with custom timeout') { expect(instance.timeout).to eq timeout }
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
describe '#wait_wrap' do
|
24
|
+
let(:instance) { api.new }
|
25
|
+
it('with custom timeout') do
|
26
|
+
expect do
|
27
|
+
instance.send(:wait_wrap, 1, 'Event Id: 1') { fail StandardError, 'Some Error' }
|
28
|
+
end.not_to raise_exception
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#wait_event' do
|
33
|
+
let(:delay) { 5 }
|
34
|
+
let(:timeout) { 5 }
|
35
|
+
let(:instance) { api.new(delay: delay, timeout: timeout) }
|
36
|
+
it('with custom timeout') do
|
37
|
+
expect do
|
38
|
+
instance.send(:wait_event, 5)
|
39
|
+
end.not_to raise_exception
|
40
|
+
end
|
41
|
+
end
|
22
42
|
end
|
@@ -195,7 +195,9 @@ RSpec.describe DoSnapshot::Adapter::Digitalocean do
|
|
195
195
|
stub_event_fail(event_id)
|
196
196
|
|
197
197
|
expect { instance.create_snapshot(droplet_id, snapshot_name) }
|
198
|
-
.
|
198
|
+
.not_to raise_error
|
199
|
+
expect(DoSnapshot.logger.buffer)
|
200
|
+
.to include "Event id: #{event_id} is failed!"
|
199
201
|
|
200
202
|
expect(a_request(:get, droplet_snapshot_url))
|
201
203
|
.to have_been_made
|
@@ -196,7 +196,9 @@ RSpec.describe DoSnapshot::Adapter::DigitaloceanV2 do
|
|
196
196
|
stub_event_fail(event_id)
|
197
197
|
|
198
198
|
expect { instance.create_snapshot(droplet_id, snapshot_name) }
|
199
|
-
.
|
199
|
+
.not_to raise_error
|
200
|
+
expect(DoSnapshot.logger.buffer)
|
201
|
+
.to include "Event id: #{event_id} is failed!"
|
200
202
|
|
201
203
|
expect(a_request(:post, droplet_snapshot_url))
|
202
204
|
.to have_been_made
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: do_snapshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Merkulov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: digitalocean_c
|