1. 23 9月, 2016 1 次提交
    • E
      docker: Handle exceptions when looking for docker command · 0679f98b
      Eduardo Habkost 提交于
      When trying to run docker tests on a host without the docker
      command,  we get the following Python backtrace:
      
        $ make docker-test-quick@centos6 V=1
        .../qemu/tests/docker/docker.py build qemu:centos6 .../qemu/tests/docker/dockerfiles/centos6.docker
        Traceback (most recent call last):
          File ".../qemu/tests/docker/docker.py", line 339, in <module>
            sys.exit(main())
          File ".../qemu/tests/docker/docker.py", line 336, in main
            return args.cmdobj.run(args, argv)
          File ".../qemu/tests/docker/docker.py", line 231, in run
            dkr = Docker()
          File ".../qemu/tests/docker/docker.py", line 98, in __init__
            self._command = _guess_docker_command()
          File ".../qemu/tests/docker/docker.py", line 41, in _guess_docker_command
            stdout=DEVNULL, stderr=DEVNULL) == 0:
          File "/usr/lib64/python2.7/subprocess.py", line 523, in call
            return Popen(*popenargs, **kwargs).wait()
          File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
            errread, errwrite)
          File "/usr/lib64/python2.7/subprocess.py", line 1343, in _execute_child
            raise child_exception
        OSError: [Errno 2] No such file or directory
        .../qemu/tests/docker/Makefile.include:47: recipe for target 'docker-image-centos6' failed
        make: *** [docker-image-centos6] Error 1
      
      Change _guess_docker_command() to handle OSError exceptions
      raised by subprocess.call(), so we will keep looking for other
      commands and print a better error message.
      
      New output will be:
      
        $ make docker-test-quick@centos6 V=1
        .../qemu/tests/docker/docker.py build qemu:centos6 .../qemu/tests/docker/dockerfiles/centos6.docker
        Traceback (most recent call last):
          File ".../qemu/tests/docker/docker.py", line 343, in <module>
            sys.exit(main())
          File ".../qemu/tests/docker/docker.py", line 340, in main
            return args.cmdobj.run(args, argv)
          File ".../qemu/tests/docker/docker.py", line 235, in run
            dkr = Docker()
          File ".../qemu/tests/docker/docker.py", line 102, in __init__
            self._command = _guess_docker_command()
          File ".../qemu/tests/docker/docker.py", line 49, in _guess_docker_command
            commands_txt)
        Exception: Cannot find working docker command. Tried:
          docker
          sudo -n docker
        .../qemu/tests/docker/Makefile.include:47: recipe for target 'docker-image-centos6' failed
        make: *** [docker-image-centos6] Error 1
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <1474369559-16903-1-git-send-email-ehabkost@redhat.com>
      [exceptions.OSError -> OSError and drop the import. - Fam]
      Signed-off-by: NFam Zheng <famz@redhat.com>
      0679f98b
  2. 22 9月, 2016 15 次提交
  3. 21 9月, 2016 24 次提交