mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user