mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 19:50:14 +01:00
Revert "client/tests: don't do dup2() dance to pass file descriptor to "tools/test-cloud-meta-mock.py""
This changed the fd passing protocol making it not compatible with
systemd-socket-activate(1).
This reverts commit 342ee618c7.
This commit is contained in:
parent
751ee63e61
commit
2e8ff9f8a0
2 changed files with 9 additions and 3 deletions
|
|
@ -2162,14 +2162,18 @@ class TestNmCloudSetup(TestNmClient):
|
|||
# hallucinogenic substances.
|
||||
s.listen(5)
|
||||
|
||||
def pass_socket():
|
||||
os.dup2(s.fileno(), 3)
|
||||
|
||||
service_path = PathConfiguration.test_cloud_meta_mock_path()
|
||||
env = os.environ.copy()
|
||||
env["LISTEN_FD"] = str(s.fileno())
|
||||
env["LISTEN_FDS"] = "1"
|
||||
p = subprocess.Popen(
|
||||
[sys.executable, service_path],
|
||||
stdin=subprocess.PIPE,
|
||||
env=env,
|
||||
pass_fds=(s.fileno(),),
|
||||
preexec_fn=pass_socket,
|
||||
)
|
||||
|
||||
self.md_url = "http://%s:%d" % s.getsockname()
|
||||
|
|
|
|||
|
|
@ -68,9 +68,11 @@ class SocketHTTPServer(HTTPServer):
|
|||
|
||||
|
||||
# See sd_listen_fds(3)
|
||||
fileno = os.getenv("LISTEN_FD")
|
||||
fileno = os.getenv("LISTEN_FDS")
|
||||
if fileno is not None:
|
||||
s = socket.socket(fileno=int(fileno))
|
||||
if fileno != "1":
|
||||
raise Exception("Bad LISTEN_FDS")
|
||||
s = socket.socket(fileno=3)
|
||||
else:
|
||||
addr = ("localhost", 0)
|
||||
s = socket.socket()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue