lib/elecksee/ephemeral.rb in elecksee-1.1.8 vs lib/elecksee/ephemeral.rb in elecksee-2.0.0
- old
+ new
@@ -91,11 +91,11 @@
def start_action
begin
lxc.start
if(ephemeral_command)
lxc.wait_for_state(:running)
- lxc.container_command(ephemeral_command)
+ lxc.container_command(ephemeral_command, 0) # no retries on ephemeral commands
else
cli_output
lxc.wait_for_state(:stopped)
end
ensure
@@ -135,11 +135,10 @@
register_traps
Process.daemon
start_action
end
else
- register_traps
start_action
end
true
end
@@ -192,10 +191,12 @@
end
content << '}'
content << 'trap scrub SIGTERM SIGINT SIGQUIT'
content << "lxc-start -n #{lxc.name} -d"
content << 'sleep 1'
- content << "lxc-wait -n #{lxc.name} -s STOPPED"
+ content << 'until [ `lxc-wait -n #{lxc.name} -s STOPPED -t 2` ]'
+ content << 'do'
+ content << 'done'
content << 'scrub'
tmp = Tempfile.new('elecksee')
tmp.chmod(0700)
tmp.puts content.join("\n")
tmp.close