frachtraum 0.0.4.pre.alpha → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/frachtraum/bsd.rb +4 -3
- data/lib/frachtraum/cli.rb +15 -3
- data/lib/frachtraum.rb +21 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDNlMDc2NmFhNzhjYjgwMWVmN2YzYmJhODQ4MGFiM2IyM2NlNDk3Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTRlZDliYzJhZTE4NGY0N2JkNDY0ZTdmZWM5YTY5NGRmZjkyMWI3NQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmFiM2E0NzZkMjU5M2RlZjg5YWY1OTllY2Y4NzY5ZWZlYjE1NmI2NTJlZWUy
|
10
|
+
OWY2YmQ3OTdjN2YwMzZiNGVmNGE0Y2Q1MTExNmRjNGRiNTE0YTBiMDdmMjZi
|
11
|
+
MWViMDZmZWRmMTVjYTg2MjhkYzdlYzFjMjZjNGIwNDFhNGE4NDY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzAxNDg4YzdjMzdmMjRiNzNiYTg3NTkwZGUzMTQwZjM2MDNjNWRjZTEzZDJl
|
14
|
+
YjdmMDM2NWU4MWM3N2E4OWMxM2ViZmUwMmM1YjcyNTJlNmVmYTRlNDlmYjk1
|
15
|
+
ZDY3YzE2NDFjZTQ0ZWIyZWZlNTdjZTg2OGVkODAyZmQ2YWM5MzY=
|
data/lib/frachtraum/bsd.rb
CHANGED
@@ -9,7 +9,7 @@ module Frachtraum
|
|
9
9
|
|
10
10
|
# first of all, decrypt and mount all depots
|
11
11
|
volumes.each do |v|
|
12
|
-
print "decrypting #{v}...".ljust(OUTPUT_DOTS_LEN,".")
|
12
|
+
print "decrypting #{v}...".ljust(OUTPUT_DOTS_LEN,".")
|
13
13
|
|
14
14
|
output = %x( echo #{password} | geli attach -d -j - /dev/label/#{v} 2>&1 )
|
15
15
|
if $?.success?
|
@@ -23,7 +23,7 @@ module Frachtraum
|
|
23
23
|
|
24
24
|
# mount timemachine targets as well
|
25
25
|
Frachtraum::TIMEMACHINE_TARGETS.each do |tmtarget|
|
26
|
-
print "mounting tm #{tmtarget}...".ljust(OUTPUT_DOTS_LEN,".")
|
26
|
+
print "mounting tm #{tmtarget}...".ljust(OUTPUT_DOTS_LEN,".")
|
27
27
|
|
28
28
|
output = %x( zfs mount #{tmtarget} 2>&1 )
|
29
29
|
if $?.success? then puts "DONE"
|
@@ -31,7 +31,8 @@ module Frachtraum
|
|
31
31
|
end
|
32
32
|
|
33
33
|
# restart samba so it reports the correct pool size
|
34
|
-
print "restarting samba server...".ljust(OUTPUT_DOTS_LEN,".")
|
34
|
+
print "restarting samba server...".ljust(OUTPUT_DOTS_LEN,".")
|
35
|
+
|
35
36
|
output = %x( /usr/local/etc/rc.d/samba restart 2>&1 )
|
36
37
|
if $?.success? then puts Rainbow("DONE").green
|
37
38
|
else puts Rainbow("FAILED!").red + " --> #{output}" end
|
data/lib/frachtraum/cli.rb
CHANGED
@@ -74,7 +74,7 @@ module Frachtraum
|
|
74
74
|
puts "" # empty line
|
75
75
|
Frachtraum::VOLUMES.each{ |volume|
|
76
76
|
status =
|
77
|
-
if Frachtraum.
|
77
|
+
if Frachtraum.zfs_volume_exists?(volume)
|
78
78
|
Rainbow("attached").green
|
79
79
|
else
|
80
80
|
Rainbow("UNAVAILABLE").red
|
@@ -95,7 +95,7 @@ module Frachtraum
|
|
95
95
|
puts "" # empty line
|
96
96
|
Frachtraum::TIMEMACHINE_TARGETS.each{ |dataset|
|
97
97
|
status =
|
98
|
-
if Frachtraum.
|
98
|
+
if Frachtraum.zfs_volume_exists?(dataset)
|
99
99
|
Rainbow("attached").green
|
100
100
|
else
|
101
101
|
Rainbow("UNAVAILABLE").red
|
@@ -123,6 +123,7 @@ module Frachtraum
|
|
123
123
|
report_rows << [ volume,
|
124
124
|
Frachtraum.pretty_SI_bytes(volume_h[:used].to_i),
|
125
125
|
Frachtraum.pretty_SI_bytes(volume_h[:available].to_i),
|
126
|
+
Frachtraum.pretty_SI_bytes(volume_h[:total].to_i),
|
126
127
|
volume_h[:compression],
|
127
128
|
volume_h[:compressratio]
|
128
129
|
]
|
@@ -130,6 +131,11 @@ module Frachtraum
|
|
130
131
|
|
131
132
|
# TODO
|
132
133
|
table = Terminal::Table.new :headings => ["VOLUMES", "USED", "AVAILABLE", "COMPRESSION", "COMPRESSRATIO"], :rows => report_rows
|
134
|
+
|
135
|
+
table.align_column(2, :right)
|
136
|
+
table.align_column(3, :right)
|
137
|
+
table.align_column(4, :right)
|
138
|
+
|
133
139
|
puts table
|
134
140
|
self.capacity
|
135
141
|
|
@@ -204,7 +210,13 @@ module Frachtraum
|
|
204
210
|
def test()
|
205
211
|
Frachtraum.run_system_test
|
206
212
|
end
|
207
|
-
|
213
|
+
|
214
|
+
# --------------
|
215
|
+
|
216
|
+
desc "version", "print version information"
|
217
|
+
def version()
|
218
|
+
puts "frachtraum version" + Frachtraum::VERSION
|
219
|
+
end
|
208
220
|
end
|
209
221
|
|
210
222
|
end
|
data/lib/frachtraum.rb
CHANGED
@@ -14,7 +14,7 @@ require 'frachtraum/osx'
|
|
14
14
|
|
15
15
|
module Frachtraum
|
16
16
|
|
17
|
-
VERSION = '0.0.
|
17
|
+
VERSION = '0.0.5'.freeze
|
18
18
|
|
19
19
|
# Kibibyte, Mebibyte, Gibibyte, etc... all the IEC sizes
|
20
20
|
BYTES_IN_KiB = 2**10
|
@@ -100,15 +100,26 @@ module Frachtraum
|
|
100
100
|
reported_values = [:used,:available,:compression,:compressratio]
|
101
101
|
|
102
102
|
(Frachtraum::VOLUMES + Frachtraum::TIMEMACHINE_TARGETS).each do |dataset|
|
103
|
-
|
104
|
-
|
103
|
+
volume_info = {}
|
104
|
+
|
105
|
+
# fetch the values
|
106
|
+
if zfs_volume_exists?(dataset)
|
105
107
|
reported_values.each do |repval|
|
106
|
-
|
108
|
+
volume_info[repval] = %x( zfs get -o value -Hp #{repval.to_s} #{dataset} )
|
107
109
|
end
|
108
110
|
else
|
109
|
-
reported_values.each {|repval|
|
111
|
+
reported_values.each {|repval| volume_info[repval] = "N/A" }
|
110
112
|
end
|
111
|
-
|
113
|
+
|
114
|
+
# calculate a total size for each volume
|
115
|
+
volume_info[:total] =
|
116
|
+
if volume_info[:used]=="N/A" || volume_info[:available]=="N/A"
|
117
|
+
"N/A"
|
118
|
+
else
|
119
|
+
volume_info[:used] + volume_info[:available]
|
120
|
+
end
|
121
|
+
|
122
|
+
report_table[dataset] = volume_info
|
112
123
|
end
|
113
124
|
|
114
125
|
return report_table
|
@@ -137,7 +148,7 @@ module Frachtraum
|
|
137
148
|
abort "sweeping not supported yet"
|
138
149
|
|
139
150
|
target_volumes.each do |volume|
|
140
|
-
if
|
151
|
+
if zfs_volume_exists?(volume)
|
141
152
|
# TODO
|
142
153
|
end
|
143
154
|
end
|
@@ -162,7 +173,7 @@ module Frachtraum
|
|
162
173
|
module_function :run_system_test
|
163
174
|
|
164
175
|
|
165
|
-
def
|
176
|
+
def zfs_volume_exists?(dataset)
|
166
177
|
output = %x( zfs get -H mounted #{dataset} 2>&1 )
|
167
178
|
case output
|
168
179
|
when /yes/
|
@@ -170,10 +181,10 @@ module Frachtraum
|
|
170
181
|
when /dataset does not exist/, /permission denied/
|
171
182
|
return false
|
172
183
|
else
|
173
|
-
abort "can't handle output of
|
184
|
+
abort "can't handle output of zfs_volume_exists?: #{output}"
|
174
185
|
end
|
175
186
|
end
|
176
|
-
module_function :
|
187
|
+
module_function :zfs_volume_exists?
|
177
188
|
|
178
189
|
end # Frachtraum
|
179
190
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frachtraum
|
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
|
- Maximilian Irro
|
@@ -115,9 +115,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: 1.9.3
|
116
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
|
-
- - ! '
|
118
|
+
- - ! '>='
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
120
|
+
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
123
|
rubygems_version: 2.4.2
|