fix(sys-ctl-hlth-runtime): deploy only on container hosts and drop the bare Docker Hub API literal

Two CI failures on PR #1265 (run 40834164415):

- Chunk 0 / SuiteCRM#2 (swarm): the post-load flush included
  sys-ctl-hlth-runtime on every play host, the NFS server too, which never
  gets sys-svc-container and therefore has no `container` CLI. The unit
  died with FileNotFoundError: 'container'. The role entry now runs only
  where a container runtime exists: in compose mode, or on swarm nodes
  ('svc-swarm-node' in group_names), the same role-entry host scoping that
  sys-ctl-hlth-csp and sys-ctl-hlth-webserver use with IS_STACK_HOST.
  Workers stay covered because PHP replicas can run there.

- Workspace (ubuntu): tests/external/repository/test_urls_reachable.py
  probed the literal "https://hub.docker.com/v2" from
  utils/docker/image/runtime.py:20 and got HTTP 404. The constant is gone;
  the endpoint is written as one f-string at the call site, the way
  utils/update/docker.py:104 and utils/update/source.py do, which the URL
  test skips as a template. With the scheme now visible in the literal,
  ruff reported the noqa: S310 on urllib.request.Request as unused.

Both test files that imported unittest twice (CodeQL) now use one
`from unittest import ...` form.

The run_once queue leak that spreads the stack host's post-load queue to
every host is fixed separately on the updater line (70ed8a2e98); when it
meets main, sys-ctl-hlth-runtime moves into sys-svc-container's queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-10-29 11:47:41 +01:00
1 parent 64affeb73e
commit feac35a5ea
4 files changed
+16 -17

No files matched your search

@@ -3,9 +3,8 @@ from __future__ import annotations
import io
import json
import tempfile
import unittest
from pathlib import Path
from unittest import mock
from unittest import TestCase, main, mock
from utils.docker.image import runtime
@@ -16,7 +15,7 @@ def _php(version=None, lines=()):
return runtime.PhpRuntime(version=version, lines=tuple(lines))
class TestPhpRuntime(unittest.TestCase):
class TestPhpRuntime(TestCase):
def test_reads_php_version_from_an_env_instruction(self):
self.assertEqual(
runtime.php_runtime(
@@ -84,7 +83,7 @@ class TestPhpRuntime(unittest.TestCase):
)
class TestPhpFinding(unittest.TestCase):
class TestPhpFinding(TestCase):
def test_a_version_below_its_floor_is_a_finding(self):
self.assertIn(
"below the security floor 8.4.27",
@@ -116,7 +115,7 @@ class TestPhpFinding(unittest.TestCase):
self.assertIsNone(runtime.php_finding(_php(lines=["8.3"]), FLOORS))
class TestLoadPhpFloors(unittest.TestCase):
class TestLoadPhpFloors(TestCase):
def test_reads_the_php_floors_from_the_vars_file(self):
with tempfile.TemporaryDirectory() as tmp:
path = Path(tmp) / "main.yml"
@@ -128,7 +127,7 @@ class TestLoadPhpFloors(unittest.TestCase):
self.assertEqual(runtime.load_php_floors(), {"8.4": "8.4.27"})
class TestBuildInstructions(unittest.TestCase):
class TestBuildInstructions(TestCase):
def test_a_docker_hub_tag_is_read_through_the_hub_api(self):
with (
mock.patch.object(
@@ -169,7 +168,7 @@ class TestBuildInstructions(unittest.TestCase):
hub.assert_not_called()
class TestHubInstructions(unittest.TestCase):
class TestHubInstructions(TestCase):
def _respond(self, payload):
response = mock.MagicMock()
response.__enter__.return_value = io.BytesIO(json.dumps(payload).encode())
@@ -212,4 +211,4 @@ class TestHubInstructions(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
main()