easy_e 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/easy_e/options.rb +4 -0
- data/lib/easy_e/snapshotter.rb +11 -0
- 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: 0a91d55595a725a593abdba2c35db12ff31fb4f6
|
4
|
+
data.tar.gz: 6bb9bd5752148dceb68db0390f0e715a1962534a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6137ed879ec554214bee56dda4195c67c56634d12d30d2b0f7f3353d2855d9ec6e556f92ed7d418650eb25df70bda87f022888ce1a209fad50769ad33e539790
|
7
|
+
data.tar.gz: 35b76fd9205b44a35102b8aa52ba31b1f971d902d0053e6c67e01dbb7f1e9bcea4315acc4afc575c455bf3d502396323dce78d659b27be23d5c73155d11ddf47
|
data/lib/easy_e/options.rb
CHANGED
@@ -31,6 +31,10 @@ class EasyE
|
|
31
31
|
options.logfile = filename
|
32
32
|
logger.debug filename
|
33
33
|
end
|
34
|
+
|
35
|
+
o.on("-d", "--directory PATH", "Only snap volumes mounted to PATH, a comma-separated list of directories") do |d|
|
36
|
+
options.directory = d
|
37
|
+
end
|
34
38
|
end
|
35
39
|
|
36
40
|
plugins.each { |plugin| plugin.collect_options @option_parser }
|
data/lib/easy_e/snapshotter.rb
CHANGED
@@ -5,6 +5,7 @@ module EasyE::Snapshotter
|
|
5
5
|
|
6
6
|
def take_snapshots
|
7
7
|
attached_volumes.collect do |vol|
|
8
|
+
next unless should_snap vol
|
8
9
|
logger.debug "Snapping #{vol.id}"
|
9
10
|
snapshot = compute.snapshots.new
|
10
11
|
snapshot.volume_id = vol.id
|
@@ -65,4 +66,14 @@ module EasyE::Snapshotter
|
|
65
66
|
id = instance_id if id.nil? or id.empty?
|
66
67
|
"#{Time.now.strftime "%Y%m%d%H%M%S"}-#{id}-#{vol.device}"
|
67
68
|
end
|
69
|
+
|
70
|
+
def should_snap vol
|
71
|
+
options.directory.nil? or devices_to_snap.include?(vol.device)
|
72
|
+
end
|
73
|
+
|
74
|
+
def devices_to_snap
|
75
|
+
@devices_to_snap ||= options.directory.split(',').map { |dir| `df --output=source #{dir} | grep dev`.strip }
|
76
|
+
logger.debug @devices_to_snap
|
77
|
+
@devices_to_snap
|
78
|
+
end
|
68
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_e
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Conrad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog
|