old_contents: __author__ = "Konstantin Osipov <kostja.osipov@gmail.com>"
  
  # Redistribution and use in source and binary forms, with or without
  # modification, are permitted provided that the following conditions
  # are met:
  # 1. Redistributions of source code must retain the above copyright
  #    notice, this list of conditions and the following disclaimer.
  # 2. Redistributions in binary form must reproduce the above copyright
  #    notice, this list of conditions and the following disclaimer in the
  #    documentation and/or other materials provided with the distribution.
  #
  # THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  # ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
  # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  
  import socket
  import yaml
  import sys
  import re
  from tarantool_connection import TarantoolConnection
  
  is_admin_re = re.compile("^\s*(show|set|save|lua|exit|reload|help)", re.I)
  
  ADMIN_SEPARATOR = '\n'
  
  class AdminConnection(TarantoolConnection):
      def execute_no_reconnect(self, command, silent):
          self.socket.sendall(command + ADMIN_SEPARATOR)
  
          bufsiz = 4096
          res = ""
  
          while True:
              buf = self.socket.recv(bufsiz)
              if not buf:
                  break
              res = res + buf
              if (res.rfind("\n...\n") >= 0 or res.rfind("\r\n...\r\n") >= 0):
                  break
  
          # validate yaml by parsing it
          yaml.load(res)
  
          if not silent:
              sys.stdout.write(command + ADMIN_SEPARATOR)
              sys.stdout.write(res.replace("\r\n", "\n"))
  
          return res
  
  
new_contents: __author__ = "Konstantin Osipov <kostja.osipov@gmail.com>"
  
  # Redistribution and use in source and binary forms, with or without
  # modification, are permitted provided that the following conditions
  # are met:
  # 1. Redistributions of source code must retain the above copyright
  #    notice, this list of conditions and the following disclaimer.
  # 2. Redistributions in binary form must reproduce the above copyright
  #    notice, this list of conditions and the following disclaimer in the
  #    documentation and/or other materials provided with the distribution.
  #
  # THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  # ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
  # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  
  import socket
  import yaml
  import sys
  import re
  from tarantool_connection import TarantoolConnection
  
  is_admin_re = re.compile("^\s*(show|set|save|lua|exit|reload|help)", re.I)
  
  ADMIN_SEPARATOR = '\n'
  
  class AdminConnection(TarantoolConnection):
      def execute_no_reconnect(self, command, silent):
          self.socket.sendall(command + ADMIN_SEPARATOR)
  
          bufsiz = 4096
          res = ""
  
          while True:
              buf = self.socket.recv(bufsiz)
              if not buf:
                  break
              res = res + buf
              if (res.rfind("\n...\n") >= 0 or res.rfind("\r\n...\r\n") >= 0):
                  break
  
          # validate yaml by parsing it
          try:
              yaml.load(res)
          finally:
              if not silent:
                  sys.stdout.write(command + ADMIN_SEPARATOR)
                  sys.stdout.write(res.replace("\r\n", "\n"))
  
          return res
  
  
subject: Test runner: even if yaml parsing fails, write the response out.