elecksee 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/lib/elecksee/vendor/lxc/libraries/lxc.rb +21 -9
- data/lib/elecksee/version.rb +1 -1
- metadata +1 -1
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -122,7 +122,7 @@ class Lxc
|
|
122
122
|
(retries.to_i + 1).times do
|
123
123
|
ip = proc_detected_address || hw_detected_address || leased_address || lxc_stored_address
|
124
124
|
return ip if ip && self.class.connection_alive?(ip)
|
125
|
-
|
125
|
+
log.warn "LXC IP discovery: Failed to detect live IP"
|
126
126
|
sleep(3) if retries > 0
|
127
127
|
end
|
128
128
|
raise "Failed to detect live IP address for container: #{name}" if raise_on_fail
|
@@ -137,7 +137,7 @@ class Lxc
|
|
137
137
|
if(ip.to_s.empty?)
|
138
138
|
nil
|
139
139
|
else
|
140
|
-
|
140
|
+
log.info "LXC Discovery: Found container address via storage: #{ip}"
|
141
141
|
ip
|
142
142
|
end
|
143
143
|
end
|
@@ -157,7 +157,7 @@ class Lxc
|
|
157
157
|
if(ip.to_s.empty?)
|
158
158
|
nil
|
159
159
|
else
|
160
|
-
|
160
|
+
log.info "LXC Discovery: Found container address via DHCP lease: #{ip}"
|
161
161
|
ip
|
162
162
|
end
|
163
163
|
end
|
@@ -175,7 +175,7 @@ class Lxc
|
|
175
175
|
if(ip.to_s.empty?)
|
176
176
|
nil
|
177
177
|
else
|
178
|
-
|
178
|
+
log.info "LXC Discovery: Found container address via HW addr: #{ip}"
|
179
179
|
ip
|
180
180
|
end
|
181
181
|
end
|
@@ -291,7 +291,7 @@ class Lxc
|
|
291
291
|
retries = args[:allow_failure_retry].to_i
|
292
292
|
begin
|
293
293
|
shlout = Mixlib::ShellOut.new(cmd,
|
294
|
-
:logger => Chef::Log.logger,
|
294
|
+
:logger => defined?(Chef) ? Chef::Log.logger : log,
|
295
295
|
:live_stream => STDOUT,
|
296
296
|
:timeout => args[:timeout] || 1200,
|
297
297
|
:environment => {'HOME' => detect_home}
|
@@ -300,8 +300,8 @@ class Lxc
|
|
300
300
|
shlout.error!
|
301
301
|
rescue Mixlib::ShellOut::ShellCommandFailed, CommandFailed, Mixlib::ShellOut::CommandTimeout
|
302
302
|
if(retries > 0)
|
303
|
-
|
304
|
-
|
303
|
+
log.warn "LXC run command failed: #{cmd}"
|
304
|
+
log.warn "Retrying command. #{args[:allow_failure_retry].to_i - retries} of #{args[:allow_failure_retry].to_i} retries remain"
|
305
305
|
sleep(0.3)
|
306
306
|
retries -= 1
|
307
307
|
retry
|
@@ -340,8 +340,8 @@ class Lxc
|
|
340
340
|
)
|
341
341
|
rescue => e
|
342
342
|
if(retries.to_i > 0)
|
343
|
-
|
344
|
-
|
343
|
+
log.info "Encountered error running container command (#{cmd}): #{e}"
|
344
|
+
log.info "Retrying command..."
|
345
345
|
retries = retries.to_i - 1
|
346
346
|
sleep(1)
|
347
347
|
retry
|
@@ -351,4 +351,16 @@ class Lxc
|
|
351
351
|
end
|
352
352
|
end
|
353
353
|
|
354
|
+
def log
|
355
|
+
if(defined?(Chef))
|
356
|
+
Chef::Log
|
357
|
+
else
|
358
|
+
unless(@logger)
|
359
|
+
require 'logger'
|
360
|
+
@logger = Logger.new('/dev/null')
|
361
|
+
end
|
362
|
+
@logger
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
354
366
|
end
|
data/lib/elecksee/version.rb
CHANGED