Overhaul httptester support in ansible-test. (#39892)

- Works with the --remote option.
- Can be disabled with the --disable-httptester option.
- Change image with the --httptester option.
- Only load and run httptester for targets that require it.
This commit is contained in:
Matt Clay 2018-05-09 09:24:39 -07:00 committed by GitHub
parent 3c32b483bc
commit c1f9efabf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 313 additions and 47 deletions

View file

@ -3,6 +3,7 @@
from __future__ import absolute_import, print_function
import atexit
import contextlib
import errno
import filecmp
import fcntl
@ -14,6 +15,7 @@ import pkgutil
import random
import re
import shutil
import socket
import stat
import string
import subprocess
@ -720,6 +722,18 @@ def parse_to_dict(pattern, value):
return match.groupdict()
def get_available_port():
"""
:rtype: int
"""
# this relies on the kernel not reusing previously assigned ports immediately
socket_fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
with contextlib.closing(socket_fd):
socket_fd.bind(('', 0))
return socket_fd.getsockname()[1]
def get_subclasses(class_type):
"""
:type class_type: type