diff --git a/docs/releases/console-3.1.27.md b/docs/releases/console-3.1.27.md new file mode 100644 index 0000000..c3670fc --- /dev/null +++ b/docs/releases/console-3.1.27.md @@ -0,0 +1,10 @@ +# Edge Console 3.1.27 + +- Fix the 3.1.26 enrollment validator to consume the actual receiver response: + each named port is an object containing local, remote and available fields. + Persist remote; do not require availability before starting the tunnel. +- Retain support for scalar port assignments and reject missing, invalid and + duplicate remote ports before changing configuration. +- Add regression coverage using the observed EVA response, including offline + endpoints and invalid nested port values. All 127 Console tests pass. +- On g-box-8e6af561, enrollment successfully applied ports 34589/34590/34591. diff --git a/stage-releases.json b/stage-releases.json index 98ace74..8ecd9a4 100644 --- a/stage-releases.json +++ b/stage-releases.json @@ -14,7 +14,7 @@ "version": "1.0.1" }, "stage_ui": { - "version": "3.1.26" + "version": "3.1.27" }, "stage_avahi": { "version": "1.0.0" diff --git a/stage_ui/console_core/backend/app.py b/stage_ui/console_core/backend/app.py index 092ceb3..deb57b8 100644 --- a/stage_ui/console_core/backend/app.py +++ b/stage_ui/console_core/backend/app.py @@ -60,7 +60,7 @@ APP_DIR = "/opt/iomatex-console" PUBLIC_DIR = os.path.join(APP_DIR, "public") PROVIDERS_DIR = os.path.join(APP_DIR, "providers.d") CONFIG_PATH = "/etc/iomatex/console.json" -UI_VERSION = "V 3.1.26" +UI_VERSION = "V 3.1.27" STORAGE_HEALTH_COMMAND = "/usr/local/sbin/iomatex-storage-health" ZONEINFO_ROOT = "/usr/share/zoneinfo" diff --git a/stage_ui/console_core/backend/itscreen_registration.py b/stage_ui/console_core/backend/itscreen_registration.py index d61bfbb..0403e46 100644 --- a/stage_ui/console_core/backend/itscreen_registration.py +++ b/stage_ui/console_core/backend/itscreen_registration.py @@ -567,6 +567,11 @@ def _validate_reverse_tunnel_ports(ports): result = {} for name in ("cockpit", "z2m", "webui"): value = ports.get(name) + # Receiver contract returns endpoint metadata; availability can be false + # until enrollment starts the tunnel. Only the assigned remote port is + # configuration; never confuse it with the local service port. + if isinstance(value, dict): + value = value.get("remote") if isinstance(value, bool) or not re.fullmatch(r"[0-9]{1,5}", str(value or "")): raise RuntimeError("Environment returned an invalid reverse tunnel port: " + name) value = int(value) diff --git a/stage_ui/console_core/backend/test_reverse_tunnel_actions_contract.py b/stage_ui/console_core/backend/test_reverse_tunnel_actions_contract.py index aa59eb2..c09638b 100644 --- a/stage_ui/console_core/backend/test_reverse_tunnel_actions_contract.py +++ b/stage_ui/console_core/backend/test_reverse_tunnel_actions_contract.py @@ -118,7 +118,7 @@ class ReverseTunnelConfigurationTest(unittest.TestCase): response = Mock() response.read.return_value = json.dumps({"reverse_tunnel": { "ssh_host": "gateway.example.com", "ssh_port": 2222, - "ssh_user": "iomatex-tunnel", "ports": {"cockpit": 34589, "z2m": 34590, "webui": 34591}, + "ssh_user": "iomatex-tunnel", "ports": {"cockpit": {"local": 9090, "remote": 34589, "available": False}, "z2m": {"local": 8081, "remote": 34590, "available": False}, "webui": {"local": 8099, "remote": 34591, "available": False}}, }}).encode() context = Mock() context.__enter__ = Mock(return_value=response) diff --git a/stage_ui/console_core/backend/test_reverse_tunnel_registration_switch.py b/stage_ui/console_core/backend/test_reverse_tunnel_registration_switch.py index 9135c69..98ff6c0 100644 --- a/stage_ui/console_core/backend/test_reverse_tunnel_registration_switch.py +++ b/stage_ui/console_core/backend/test_reverse_tunnel_registration_switch.py @@ -29,6 +29,16 @@ class RegistrationTunnelSwitchTest(unittest.TestCase): output = subprocess.check_output([str(root / ("iomatex-rt-" + name + ".sh"))], env=env, text=True) self.assertIn("127.0.0.1:%s:127.0.0.1:%s" % (remote, local), output) + def test_receiver_endpoint_objects_use_remote_ports_even_when_offline(self): + ports = {"cockpit": {"local": 9090, "remote": 34589, "available": False}, + "webui": {"local": 8099, "remote": 34591, "available": False}, + "z2m": {"local": 8081, "remote": 34590, "available": False}} + self.assertEqual({"cockpit": 34589, "z2m": 34590, "webui": 34591}, + registration._validate_reverse_tunnel_ports(ports)) + for invalid in ({"local": 9090}, {"remote": True}, {"remote": 65536}): + with self.subTest(value=invalid), self.assertRaises(RuntimeError): + registration._validate_reverse_tunnel_ports(dict(ports, cockpit=invalid)) + def test_invalid_server_ports_are_rejected(self): valid = {"cockpit": 34589, "z2m": 34590, "webui": 34591} for bad in (None, True, 0, 65536, "12; reboot", 34590): diff --git a/stage_ui/console_core/frontend/console.js b/stage_ui/console_core/frontend/console.js index c24ef05..6d62608 100644 --- a/stage_ui/console_core/frontend/console.js +++ b/stage_ui/console_core/frontend/console.js @@ -49,7 +49,7 @@ { mode: "test_by", label: "test.it-screen.by", host: "rest.test.it-screen.by" }, { mode: "custom", label: "Custom", host: "" } ]; - const UI_VERSION = "V 3.1.26"; + const UI_VERSION = "V 3.1.27"; const ITSCREEN_LOG_INITIAL_LINES = 50; const ITSCREEN_LOG_BUFFER_LIMIT = 300; const ITSCREEN_LOG_BATCH_MS = 250; diff --git a/stage_ui/console_core/frontend/index.html b/stage_ui/console_core/frontend/index.html index a88e902..a1b61c8 100644 --- a/stage_ui/console_core/frontend/index.html +++ b/stage_ui/console_core/frontend/index.html @@ -23,7 +23,7 @@ } catch (error) {} })(); - +