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