snapsync 0.3.2 → 0.3.3

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
  SHA1:
3
- metadata.gz: 310d54c72fbee1f6e3b178b31ab584acb828b959
4
- data.tar.gz: 941288cf6057ee138b0c8cefc9e46f03654ae7da
3
+ metadata.gz: 1db39c52daf088025f37bad911ed2cdf61b636d2
4
+ data.tar.gz: 2d301b73b85d3331020945823873403484230e13
5
5
  SHA512:
6
- metadata.gz: a2c390799559934ba49dda8169cfccd4bce70ac3131dc10de722e9d6522e116d0edef8933960bf07cb14841ec668ae78a0992591f4f0045c7ecf5f013bfb3724
7
- data.tar.gz: 38362e18d5b9195cc4d4ed1b3b5cc820b594eed2a4d73cb2fa3d4042b559ca572224ca283097c08192bfd5c8a27564c23680058bd8624965914479d46391c3c7
6
+ metadata.gz: cde7036bd9b9f4a02384d2ddb317905255ba064341b05cd0483ff62a3fbbe4745ddcc0ab599559faa2a51ed82d14fd68d1ac92378a41e0566758d1cfbb331308
7
+ data.tar.gz: af261e9db68b0905ba7b138956c5e98a29e783fbe5f4db7739091a226ec08342fb156518b4e805fd971cf249be589ed7324373061b6e1f4d3657c70348678737
@@ -32,16 +32,6 @@ module Snapsync
32
32
  true
33
33
  end
34
34
  end
35
-
36
- if !deleted_snapshots.empty?
37
- Snapsync.info "Waiting for subvolumes to be deleted"
38
- deleted_snapshots.each do |s|
39
- begin
40
- Btrfs.popen("subvolume", "sync", s.subvolume_dir.to_s)
41
- rescue Btrfs::Error
42
- end
43
- end
44
- end
45
35
  end
46
36
  end
47
37
  end
data/lib/snapsync/cli.rb CHANGED
@@ -150,29 +150,23 @@ policy for more information
150
150
  # Parse the policy option early to avoid breaking later
151
151
  begin
152
152
  policy = normalize_policy(policy)
153
- rescue Exception
153
+ rescue Exception => policy_validation_error
154
154
  # Try to see if the user forgot to add the NAME option or added
155
155
  # the name option but should not have
156
156
  if options[:auto]
157
- valid_policy = begin normalize_policy(args[1..-1])
158
- true
159
- rescue InvalidConfiguration
160
- false
161
- end
162
- if valid_policy
157
+ begin
158
+ normalize_policy(args[1..-1])
163
159
  raise ArgumentError, "--auto is set but it seems that you did not provide a name"
160
+ rescue InvalidConfiguration
164
161
  end
165
162
  else
166
- valid_policy = begin normalize_policy(args[2..-1])
167
- true
168
- rescue InvalidConfiguration
169
- false
170
- end
171
- if valid_policy
163
+ begin
164
+ normalize_policy(args[2..-1])
172
165
  raise ArgumentError, "--auto is not set but it seems that you provided a name"
166
+ rescue InvalidConfiguration
173
167
  end
174
168
  end
175
- raise ArgumentError, "invalid policy #{policy}"
169
+ raise policy_validation_error
176
170
  end
177
171
 
178
172
  dirs = Array.new
@@ -17,7 +17,7 @@ module Snapsync
17
17
  def create_synchronization_point
18
18
  config.create(
19
19
  description: "synchronization snapshot for snapsync",
20
- user_data: Hash['important' => 'yes', 'snapsync' => target.uuid])
20
+ user_data: Hash['important' => 'yes', 'snapsync-description' => target.description, 'snapsync' => target.uuid])
21
21
  end
22
22
 
23
23
  def remove_synchronization_points(except_last: true)
@@ -34,6 +34,10 @@ module Snapsync
34
34
  class InvalidUUIDError < InvalidTargetPath; end
35
35
  class NoUUIDError < InvalidUUIDError; end
36
36
 
37
+ def description
38
+ "local:#{dir}"
39
+ end
40
+
37
41
  def initialize(dir, create_if_needed: true)
38
42
  if !dir.directory?
39
43
  raise ArgumentError, "#{dir} does not exist"
@@ -168,18 +172,19 @@ module Snapsync
168
172
  return if dry_run
169
173
 
170
174
  begin
171
- Btrfs.popen("subvolume", "delete", s.subvolume_dir.to_s)
175
+ Btrfs.popen("subvolume", "delete", '--commit-each', s.subvolume_dir.to_s)
172
176
  rescue Btrfs::Error
173
177
  Snapsync.warn "failed to remove snapshot at #{s.subvolume_dir}, keeping the rest of the snapshot"
174
178
  return
175
179
  end
176
180
 
177
- s.snapshot_dir.rmtree
178
181
  Snapsync.info "Flushing data to disk"
179
182
  begin
180
- Btrfs.popen("subvolume", "sync", s.subvolume_dir.to_s)
183
+ Btrfs.popen("subvolume", "sync", self.dir.to_s)
181
184
  rescue Btrfs::Error
182
185
  end
186
+
187
+ s.snapshot_dir.rmtree
183
188
  end
184
189
  end
185
190
  end
@@ -1,3 +1,3 @@
1
1
  module Snapsync
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snapsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-01 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -232,9 +232,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  version: '0'
233
233
  requirements: []
234
234
  rubyforge_project:
235
- rubygems_version: 2.2.3
235
+ rubygems_version: 2.5.1
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: tool to automate backing up snapper snapshots to other medias
239
239
  test_files: []
240
- has_rdoc: