snapsync 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/snapsync/auto_sync.rb +2 -2
- data/lib/snapsync/cleanup.rb +8 -3
- data/lib/snapsync/cli.rb +7 -6
- data/lib/snapsync/sync_all.rb +2 -2
- data/lib/snapsync/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62c200ca50a3f1aa39d7ba8ece8167cedd05dd09
|
4
|
+
data.tar.gz: fe946f70afa36619c9aa307704762a4a9d4afb81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 746d7b8a0c4b18a9aa121de9dfb7a03ceeec4492a8f8c4143a907505d2555c0c778166f55026d932ee482c1e8be0475443175e8e5917e716271b010918bb4805
|
7
|
+
data.tar.gz: cb76bb425572ea908df6a5c1609a73e17a2ff37cf725b64373e7fbdb6c5eaf744cd3f8000c3490194ec0c4e6d28ee22fb500b1e1af9e655b44e650e070a4a535
|
data/lib/snapsync/auto_sync.rb
CHANGED
@@ -125,8 +125,8 @@ module Snapsync
|
|
125
125
|
return enum_for(__method__) if !block_given?
|
126
126
|
each_available_autosync_target do |path, t|
|
127
127
|
op = SyncAll.new(path, config_dir: config_dir)
|
128
|
-
op.each_target do |target|
|
129
|
-
yield(target)
|
128
|
+
op.each_target do |config, target|
|
129
|
+
yield(config, target)
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
data/lib/snapsync/cleanup.rb
CHANGED
@@ -26,14 +26,19 @@ module Snapsync
|
|
26
26
|
filtered_snapshots << last_sync_point
|
27
27
|
filtered_snapshots = filtered_snapshots.to_set
|
28
28
|
|
29
|
-
snapshots.sort_by(&:num).
|
29
|
+
deleted_snapshots = snapshots.sort_by(&:num).find_all do |s|
|
30
30
|
if !filtered_snapshots.include?(s)
|
31
31
|
target.delete(s, dry_run: dry_run)
|
32
|
+
true
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
if !deleted_snapshots.empty?
|
37
|
+
Snapsync.info "Waiting for subvolumes to be deleted"
|
38
|
+
deleted_snapshots.each do |s|
|
39
|
+
IO.popen(["btrfs", "subvolume", "sync", s.subvolume_dir.to_s, err: '/dev/null']).read
|
40
|
+
end
|
41
|
+
end
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
data/lib/snapsync/cli.rb
CHANGED
@@ -42,13 +42,13 @@ module Snapsync
|
|
42
42
|
rescue LocalTarget::InvalidTargetPath
|
43
43
|
end
|
44
44
|
|
45
|
-
SyncAll.new(dir).each_target do |target|
|
46
|
-
yield(target)
|
45
|
+
SyncAll.new(dir).each_target do |config, target|
|
46
|
+
yield(config, target)
|
47
47
|
end
|
48
48
|
else
|
49
49
|
autosync = AutoSync.load_default
|
50
|
-
autosync.each_available_target do |target|
|
51
|
-
yield(target)
|
50
|
+
autosync.each_available_target do |config, target|
|
51
|
+
yield(config, target)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -73,6 +73,7 @@ module Snapsync
|
|
73
73
|
def sync_all(dir)
|
74
74
|
handle_class_options
|
75
75
|
|
76
|
+
dir = Pathname.new(dir)
|
76
77
|
op = SyncAll.new(dir, config_dir: SnapperConfig.default_config_dir, autoclean: options[:autoclean])
|
77
78
|
op.run
|
78
79
|
end
|
@@ -196,7 +197,7 @@ for 10 days). snapsync understands the following period names: year month day ho
|
|
196
197
|
EOD
|
197
198
|
def policy(dir, type, *options)
|
198
199
|
handle_class_options
|
199
|
-
each_target(dir) do |target|
|
200
|
+
each_target(dir) do |_, target|
|
200
201
|
target.change_policy(type, options)
|
201
202
|
target.write_config
|
202
203
|
end
|
@@ -230,7 +231,7 @@ While it can easily be done manually, this command makes sure that the snapshots
|
|
230
231
|
desc 'list [DIR]', 'list the snapshots present on DIR. If DIR is omitted, tries to access all targets defined as auto-sync targets'
|
231
232
|
def list(dir = nil)
|
232
233
|
handle_class_options
|
233
|
-
each_target(dir) do |target|
|
234
|
+
each_target(dir) do |_, target|
|
234
235
|
puts "== #{target.dir}"
|
235
236
|
puts "UUID: #{target.uuid}"
|
236
237
|
puts "Enabled: #{target.enabled?}"
|
data/lib/snapsync/sync_all.rb
CHANGED
@@ -40,13 +40,13 @@ module Snapsync
|
|
40
40
|
if !dir.exist?
|
41
41
|
Snapsync.warn "no directory for configuration #{config.name} in #{target_dir}"
|
42
42
|
else
|
43
|
-
yield(LocalTarget.new(dir))
|
43
|
+
yield(config, LocalTarget.new(dir))
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
def run
|
49
|
-
each_target do |target|
|
49
|
+
each_target do |config, target|
|
50
50
|
if !target.enabled?
|
51
51
|
Snapsync.warn "not synchronizing to #{target.dir}, it is disabled"
|
52
52
|
next
|
data/lib/snapsync/version.rb
CHANGED