vagrant-logs 0.1.0 → 0.1.1

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: a4e46eb4186a5fc00c2a87ada969c181151f49a6
4
- data.tar.gz: 295704f4d14bc5bb297d0355302a56689d71cb64
3
+ metadata.gz: e6b5f43f532a04d7c2d656437af8e9890708c6d0
4
+ data.tar.gz: 7d174e0841e7ecb93e9aa53386d147dbb0037590
5
5
  SHA512:
6
- metadata.gz: 1f730b5bbd0ac9df8b298de324fc9cf84f70d3516d827f434c74834403962c7f3e8d19bac9c2939de0de47a4b18060694c2334b78fa65115900fc8c709920bb6
7
- data.tar.gz: 9c7633f06808b5af3caeab9c464b02fcb49c06eef3018aba659ab1b5022c753d31fd511f40be991bc4bace3fb61c6d056ef651fdef77e1655a326eb22d576bd3
6
+ metadata.gz: f94b8bb366f429d909de71279293d45513197e013a9fbfab3e8f6eb5ae147ad5edd76b47cc045485db7f80bff97a4c2f1818c35a8ef357b9085ee981db585f27
7
+ data.tar.gz: 196c55703e0a200cc354fd903b8b365e2fb04f0c9bda67cfb2279bf699963b51c2afba19559fce25b66abe5df3559bf03c267c0b58d87fab6549eef972b34201
@@ -45,20 +45,24 @@ module VagrantPlugins
45
45
 
46
46
  log_files.delete_if do |log_file|
47
47
  if log_file.include?('*')
48
- vm.communicate.sudo("ls -1 #{log_file}") do |type, data|
49
- case type
50
- when :stdout
51
- expanded_file_names << data.split(/[\r\n]+/)
52
- when :stderr
53
- puts data and exit 1
48
+ begin
49
+ vm.communicate.sudo("ls -1 #{log_file}") do |type, data|
50
+ case type
51
+ when :stdout
52
+ expanded_file_names << data.split(/[\r\n]+/)
53
+ when :stderr
54
+ puts data and exit 1
55
+ end
54
56
  end
57
+ rescue Vagrant::Errors::VagrantError => e
58
+ print_sudo_exception(e)
55
59
  end
56
60
 
57
61
  true
58
62
  end
59
63
  end
60
64
 
61
- puts "Ok\n"
65
+ puts "Done\n"
62
66
 
63
67
  (log_files + expanded_file_names).flatten
64
68
  end
@@ -68,17 +72,21 @@ module VagrantPlugins
68
72
  result = {}
69
73
 
70
74
  vm.config.vagrant_logs.log_files.each do |log_file|
71
- vm.communicate.sudo("tail -#{vm.config.vagrant_logs.lines} #{log_file}") do |type, data|
72
- case type
73
- when :stdout
74
- result[log_file] = data.split(/[\r\n]+/)
75
- when :stderr
76
- puts data and exit 1
75
+ begin
76
+ vm.communicate.sudo("tail -#{vm.config.vagrant_logs.lines} #{log_file}") do |type, data|
77
+ case type
78
+ when :stdout
79
+ result[log_file] = data.split(/[\r\n]+/)
80
+ when :stderr
81
+ puts data and exit 1
82
+ end
77
83
  end
84
+ rescue Vagrant::Errors::VagrantError => e
85
+ print_sudo_exception(e)
78
86
  end
79
87
  end
80
88
 
81
- puts "Ok\n"
89
+ puts "Done\n"
82
90
 
83
91
  result
84
92
  end
@@ -157,16 +165,21 @@ module VagrantPlugins
157
165
 
158
166
  result = ''
159
167
 
160
- vm.communicate.sudo("host -t ns google.com") do |type, data|
161
- case type
162
- when :stdout
163
- result = data
164
- when :stderr
165
- puts data and exit 1
168
+ begin
169
+ vm.communicate.sudo("host -t ns google.com") do |type, data|
170
+ case type
171
+ when :stdout
172
+ result = data
173
+ when :stderr
174
+ puts data and exit 1
175
+ end
166
176
  end
167
- end
168
177
 
169
- puts "Ok\n"
178
+ puts "Ok\n"
179
+ rescue Vagrant::Errors::VagrantError => e
180
+ print("Failed\n")
181
+ print_sudo_exception(e)
182
+ end
170
183
 
171
184
  !result.include?('no servers could be reached')
172
185
  end
@@ -211,6 +224,11 @@ module VagrantPlugins
211
224
 
212
225
  puts "\n"
213
226
  end
227
+
228
+ def print_sudo_exception(exception)
229
+ puts "Following error occured, but will be ignored:\n"
230
+ puts exception.message
231
+ end
214
232
  end
215
233
  end
216
234
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module CommandLogs
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - seppsepp
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-11 00:00:00.000000000 Z
12
+ date: 2016-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gist