fluke/devops-service/commands/stack.rb
2015-07-20 19:59:26 +04:00

24 lines
558 B
Ruby

module StackCommands
def sync_stack_till_not_in_progress_proc
lambda do |out, stack, mongo|
begin
10.times do |i|
sleep 10
out << "Syncing stack '#{stack.id}'..."
stack.sync_details!
if stack.stack_status != 'CREATE_IN_PROGRESS'
mongo.stack_update(stack)
out << "Stack '#{stack.id}' status is now #{stack.stack_status}"
break
end
end
rescue StandardError => e
logger.error e.message
return 5
end
end
end
end