manta-node 0.6b6.dev850__py3-none-any.whl → 0.6b6.dev855__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- manta_node/cli/_version_generated.py +3 -3
- manta_node/infrastructure/mqtt/command_handler.py +21 -9
- manta_node/node_orchestrator.py +73 -27
- {manta_node-0.6b6.dev850.dist-info → manta_node-0.6b6.dev855.dist-info}/METADATA +1 -1
- {manta_node-0.6b6.dev850.dist-info → manta_node-0.6b6.dev855.dist-info}/RECORD +9 -9
- {manta_node-0.6b6.dev850.dist-info → manta_node-0.6b6.dev855.dist-info}/WHEEL +0 -0
- {manta_node-0.6b6.dev850.dist-info → manta_node-0.6b6.dev855.dist-info}/entry_points.txt +0 -0
- {manta_node-0.6b6.dev850.dist-info → manta_node-0.6b6.dev855.dist-info}/licenses/LICENSE +0 -0
- {manta_node-0.6b6.dev850.dist-info → manta_node-0.6b6.dev855.dist-info}/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ This file is auto-generated at build time by scripts/generate_version.py.
|
|
|
4
4
|
Do not edit manually.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
__version__ = "2026.11.
|
|
8
|
-
__build_date__ = "2026.11.
|
|
9
|
-
__commit_id__ = "
|
|
7
|
+
__version__ = "2026.11.18.f80a06ef"
|
|
8
|
+
__build_date__ = "2026.11.18"
|
|
9
|
+
__commit_id__ = "f80a06ef"
|
|
10
10
|
__package_version__ = "0.6b6" # release-series base, moved by scripts/bump_version.py
|
|
@@ -138,11 +138,13 @@ class CommandHandler(Collector, MqttBase):
|
|
|
138
138
|
Runtime broker role username (caller-sourced; not persisted).
|
|
139
139
|
mqtt_password : Optional[str]
|
|
140
140
|
Runtime broker role password (caller-sourced; not persisted).
|
|
141
|
+
Both may be None only with ``certificate_broker`` set.
|
|
141
142
|
certificate_broker : Optional[CertificateBroker]
|
|
142
143
|
The node's own broker certificate and its listener (#546). When set,
|
|
143
144
|
the handler connects there with the certificate and no username or
|
|
144
|
-
password
|
|
145
|
-
|
|
145
|
+
password. When the broker does not accept the certificate or it is no
|
|
146
|
+
longer in date, the handler falls back to the password listener, or,
|
|
147
|
+
with no password given, stops the node with the reason (#555).
|
|
146
148
|
"""
|
|
147
149
|
|
|
148
150
|
def __init__(
|
|
@@ -183,9 +185,13 @@ class CommandHandler(Collector, MqttBase):
|
|
|
183
185
|
self._certificate_connect_failures = 0
|
|
184
186
|
self._connected_once = False
|
|
185
187
|
|
|
186
|
-
#
|
|
187
|
-
# fallback whenever the certificate
|
|
188
|
-
|
|
188
|
+
# A certificate-only node has neither; a node with a password keeps the
|
|
189
|
+
# password listener as its fallback whenever the certificate fails.
|
|
190
|
+
has_password = bool(mqtt_username and mqtt_password)
|
|
191
|
+
self._certificate_only = (
|
|
192
|
+
certificate_broker is not None and not mqtt_username and not mqtt_password
|
|
193
|
+
)
|
|
194
|
+
if not has_password and not self._certificate_only:
|
|
189
195
|
raise MantaNodeError(
|
|
190
196
|
"MQTT broker username and password must both be provided"
|
|
191
197
|
)
|
|
@@ -237,8 +243,8 @@ class CommandHandler(Collector, MqttBase):
|
|
|
237
243
|
if inspect.isawaitable(result):
|
|
238
244
|
await result
|
|
239
245
|
|
|
240
|
-
# Before the password-path checks below
|
|
241
|
-
# certificate
|
|
246
|
+
# Before the password-path checks below: in certificate mode only the
|
|
247
|
+
# certificate rules decide whether a connect error stops the node.
|
|
242
248
|
if self._certificate_broker is not None:
|
|
243
249
|
self._on_certificate_connect_error(exc)
|
|
244
250
|
return
|
|
@@ -263,8 +269,10 @@ class CommandHandler(Collector, MqttBase):
|
|
|
263
269
|
def _on_certificate_connect_error(self, exc: Exception) -> None:
|
|
264
270
|
"""Fall back to the password listener when the certificate cannot work.
|
|
265
271
|
|
|
266
|
-
|
|
267
|
-
same certificate in date and fail again, a crash loop
|
|
272
|
+
A node with a password never stops over its certificate: the next start
|
|
273
|
+
would find the same certificate in date and fail again, a crash loop
|
|
274
|
+
under a supervisor. A certificate-only node stops instead, so a refused
|
|
275
|
+
certificate is reported rather than hidden.
|
|
268
276
|
"""
|
|
269
277
|
broker = cast(CertificateBroker, self._certificate_broker)
|
|
270
278
|
if not BrokerCertificateStore(broker.folder).has_usable_certificate(
|
|
@@ -301,6 +309,10 @@ class CommandHandler(Collector, MqttBase):
|
|
|
301
309
|
)
|
|
302
310
|
|
|
303
311
|
def _fall_back_to_password_listener(self, reason: str) -> None:
|
|
312
|
+
if self._certificate_only:
|
|
313
|
+
message = f"MQTT: {reason}; the node has no broker password and stops"
|
|
314
|
+
self.tracer.error(message)
|
|
315
|
+
raise MantaNodeError(message)
|
|
304
316
|
self.tracer.warning(
|
|
305
317
|
f"MQTT: {reason}; using the broker password at {self._password_address}"
|
|
306
318
|
)
|
manta_node/node_orchestrator.py
CHANGED
|
@@ -20,6 +20,7 @@ from manta_common.build.common.informations import (
|
|
|
20
20
|
NodeUpdatePath,
|
|
21
21
|
Registration,
|
|
22
22
|
)
|
|
23
|
+
from manta_common.build.common.mqtt import MqNodeStatus
|
|
23
24
|
from manta_common.build.common.system import Empty
|
|
24
25
|
from manta_common.conversions import HEX_SIZE, ID, oid
|
|
25
26
|
from manta_common.errors import MantaError
|
|
@@ -158,15 +159,28 @@ def _find_tls_error(error: BaseException) -> ssl.SSLError | None:
|
|
|
158
159
|
return None
|
|
159
160
|
|
|
160
161
|
|
|
161
|
-
|
|
162
|
-
"""
|
|
162
|
+
class _NoNodeCertificate(Exception):
|
|
163
|
+
"""Why the node has no usable broker certificate."""
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def _mqtt_broker_credentials_from_env(
|
|
167
|
+
certificate_only_allowed: bool,
|
|
168
|
+
) -> tuple[str, str] | None:
|
|
169
|
+
"""Return the broker role credential pair from the runtime environment.
|
|
170
|
+
|
|
171
|
+
None means a certificate-only node: neither variable is set and
|
|
172
|
+
``certificate_only_allowed`` (``security.node_certificate``) is on. A node
|
|
173
|
+
with only one of the two set is misconfigured, never certificate-only.
|
|
174
|
+
"""
|
|
163
175
|
username = os.getenv(MQTT_BROKER_USERNAME_ENV)
|
|
164
176
|
password = os.getenv(MQTT_BROKER_PASSWORD_ENV)
|
|
165
|
-
if
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
177
|
+
if username and password:
|
|
178
|
+
return username, password
|
|
179
|
+
if certificate_only_allowed and not username and not password:
|
|
180
|
+
return None
|
|
181
|
+
raise NodeFatalError(
|
|
182
|
+
"MQTT broker username and password must both be set before startup"
|
|
183
|
+
)
|
|
170
184
|
|
|
171
185
|
|
|
172
186
|
def reserve_available_port(
|
|
@@ -515,7 +529,18 @@ class Node:
|
|
|
515
529
|
NodeFatalError
|
|
516
530
|
If MQTT client unreacheable or gRPC error occurs
|
|
517
531
|
"""
|
|
518
|
-
|
|
532
|
+
credentials = _mqtt_broker_credentials_from_env(
|
|
533
|
+
certificate_only_allowed=self.config.security.node_certificate
|
|
534
|
+
)
|
|
535
|
+
certificate_only = credentials is None
|
|
536
|
+
mqtt_username: str | None = None
|
|
537
|
+
mqtt_password: str | None = None
|
|
538
|
+
if credentials is not None:
|
|
539
|
+
mqtt_username, mqtt_password = credentials
|
|
540
|
+
else:
|
|
541
|
+
self.tracer.info(
|
|
542
|
+
"No broker password is set; the node connects with its certificate only"
|
|
543
|
+
)
|
|
519
544
|
await self.check_manager_availability()
|
|
520
545
|
try:
|
|
521
546
|
version_info = get_full_version_info()
|
|
@@ -579,7 +604,7 @@ class Node:
|
|
|
579
604
|
# After the node client holds the node token: the certificate call
|
|
580
605
|
# names the node by that token.
|
|
581
606
|
certificate_broker = await self._certificate_broker(
|
|
582
|
-
registration, node_token
|
|
607
|
+
registration, node_token, certificate_only=certificate_only
|
|
583
608
|
)
|
|
584
609
|
|
|
585
610
|
# Ensure light service port is assigned
|
|
@@ -655,6 +680,14 @@ class Node:
|
|
|
655
680
|
# Create asyncio tasks and start them
|
|
656
681
|
self.command_loop = asyncio.create_task(self.command_handler.main())
|
|
657
682
|
self.light_server_task = asyncio.create_task(self.server.wait_closed())
|
|
683
|
+
except NodeFatalError:
|
|
684
|
+
# The startup error is the reason the node gives; a failure while
|
|
685
|
+
# stopping must never replace it.
|
|
686
|
+
try:
|
|
687
|
+
await self.stop()
|
|
688
|
+
except Exception:
|
|
689
|
+
self.tracer.exception("Stopping the node after a failed start failed")
|
|
690
|
+
raise
|
|
658
691
|
except ConnectionRefusedError:
|
|
659
692
|
self.tracer.exception("Unable to start and connect to MQTT Message Broker")
|
|
660
693
|
raise NodeFatalError(
|
|
@@ -693,33 +726,48 @@ class Node:
|
|
|
693
726
|
raise NodeFatalError(f"[ERROR] {message}") from exc
|
|
694
727
|
|
|
695
728
|
async def _certificate_broker(
|
|
696
|
-
self, registration: Registration, node_token: str
|
|
729
|
+
self, registration: Registration, node_token: str, certificate_only: bool
|
|
697
730
|
) -> CertificateBroker | None:
|
|
698
731
|
"""The certificate listener with a usable node certificate, or None for
|
|
699
732
|
the password path.
|
|
700
733
|
|
|
701
734
|
With ``security.node_certificate`` on, a node that holds no usable
|
|
702
|
-
certificate requests one over its node token (#546).
|
|
703
|
-
|
|
704
|
-
|
|
735
|
+
certificate requests one over its node token (#546). A node with a
|
|
736
|
+
broker password takes the password path on every failure, as with the
|
|
737
|
+
flag off. A ``certificate_only`` node has no password path, so every
|
|
738
|
+
failure stops it with the reason (#555).
|
|
739
|
+
|
|
740
|
+
Raises
|
|
741
|
+
------
|
|
742
|
+
NodeFatalError
|
|
743
|
+
A ``certificate_only`` node has no usable certificate.
|
|
705
744
|
"""
|
|
706
745
|
if not self.config.security.node_certificate:
|
|
707
746
|
return None
|
|
747
|
+
try:
|
|
748
|
+
return await self._obtain_certificate_broker(registration, node_token)
|
|
749
|
+
except _NoNodeCertificate as reason:
|
|
750
|
+
if certificate_only:
|
|
751
|
+
message = (
|
|
752
|
+
f"{reason}; the node has no broker password and cannot connect"
|
|
753
|
+
)
|
|
754
|
+
self.tracer.error(message)
|
|
755
|
+
raise NodeFatalError(f"[ERROR] {message}") from None
|
|
756
|
+
self.tracer.warning(f"{reason}; using the broker password")
|
|
757
|
+
return None
|
|
758
|
+
|
|
759
|
+
async def _obtain_certificate_broker(
|
|
760
|
+
self, registration: Registration, node_token: str
|
|
761
|
+
) -> CertificateBroker:
|
|
708
762
|
if not (
|
|
709
763
|
registration.mqtt_certificate_broker_host
|
|
710
764
|
and registration.mqtt_certificate_broker_port
|
|
711
765
|
):
|
|
712
|
-
|
|
713
|
-
"The manager offers no certificate listener; using the broker password"
|
|
714
|
-
)
|
|
715
|
-
return None
|
|
766
|
+
raise _NoNodeCertificate("The manager offers no certificate listener")
|
|
716
767
|
|
|
717
768
|
node_id = node_id_from_token(node_token)
|
|
718
769
|
if node_id is None:
|
|
719
|
-
|
|
720
|
-
"The node token carries no node id; using the broker password"
|
|
721
|
-
)
|
|
722
|
-
return None
|
|
770
|
+
raise _NoNodeCertificate("The node token carries no node id")
|
|
723
771
|
store = BrokerCertificateStore(
|
|
724
772
|
Path(self.config.security.node_certificate_folder).expanduser()
|
|
725
773
|
)
|
|
@@ -747,10 +795,7 @@ class Node:
|
|
|
747
795
|
issued.certificate_pem or "", issued.certificate_chain_pem or ""
|
|
748
796
|
)
|
|
749
797
|
except (MantaError, OSError, ValueError, TypeError) as error:
|
|
750
|
-
|
|
751
|
-
f"No node certificate ({error}); using the broker password"
|
|
752
|
-
)
|
|
753
|
-
return None
|
|
798
|
+
raise _NoNodeCertificate(f"No node certificate ({error})") from error
|
|
754
799
|
self.tracer.info(f"Node certificate issued and stored in {store.folder}")
|
|
755
800
|
return broker
|
|
756
801
|
|
|
@@ -781,8 +826,9 @@ class Node:
|
|
|
781
826
|
self.tracer.info("Publishing node status to manager")
|
|
782
827
|
await self.command_handler.client.publish(
|
|
783
828
|
"manager/set_node_status",
|
|
784
|
-
|
|
785
|
-
|
|
829
|
+
MqNodeStatus(
|
|
830
|
+
token=self.node_client.secured_token,
|
|
831
|
+
status=NodeStatus(status=NodeStatusEnum.DISCONNECTED),
|
|
786
832
|
).SerializeToString(),
|
|
787
833
|
)
|
|
788
834
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: manta_node
|
|
3
|
-
Version: 0.6b6.
|
|
3
|
+
Version: 0.6b6.dev855
|
|
4
4
|
Summary: Node side software of the Manta platform. It is responsible for the communication with the Manta Core and the execution of the tasks.
|
|
5
5
|
Author-email: Hugo Miralles <hugo.miralles@manta-tech.io>, Matthew Thompson <matthew.thompson@manta-tech.io>
|
|
6
6
|
License-Expression: AGPL-3.0-or-later
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
manta_node/__init__.py,sha256=bgGWXH3yQVhNf0v1ZGUBAy5Y51fqb0Y-EaLnocbcino,153
|
|
2
2
|
manta_node/__main__.py,sha256=SjrJyuMg_ZFKV6WOVe3MrtWM8Qmu065dkKZYl4n2YLw,1665
|
|
3
|
-
manta_node/node_orchestrator.py,sha256=
|
|
3
|
+
manta_node/node_orchestrator.py,sha256=9UQD_tLKG2RjzU_sadEyuk9qgq-3-y2Pj8iCFp1P6so,35125
|
|
4
4
|
manta_node/seam.py,sha256=nGLjNVlSrnRJPdrp7L8piyJai1bQveiqT5JDBWeFeGI,6501
|
|
5
5
|
manta_node/task_manager.py,sha256=xRE-yKdUW0FFR8vtX1jDwl1AxTbqVD_JS7QVR62GA00,38002
|
|
6
6
|
manta_node/tasks.py,sha256=o837Hi-KFVJg9LF5iOtE8oD6UuTOfrEPWR-JOdhRGeY,6983
|
|
7
7
|
manta_node/update_path.py,sha256=6N_bN9z8MqnyWWfGTe1-aJFijf2tSy_IvO6VHvNSQVU,1667
|
|
8
8
|
manta_node/utils.py,sha256=Hw4Iw2jYQYsfVLVJuBMt-_rMFBeml3nCDE2jiiXc8YM,1155
|
|
9
9
|
manta_node/cli/__init__.py,sha256=arzO3mXDJ-E2yeeytbZfN7mCswwxdQ43_QjyeL2E5yE,134
|
|
10
|
-
manta_node/cli/_version_generated.py,sha256=
|
|
10
|
+
manta_node/cli/_version_generated.py,sha256=_yvPs9l-H8KiQCwr013cnqy3FoPV0-pT3HtrWgf7qMY,332
|
|
11
11
|
manta_node/cli/config_manager.py,sha256=BCju9zqzraviL3KrzRnB-vZQUY__Q5kuEqb7EdB8YdI,4409
|
|
12
12
|
manta_node/cli/main.py,sha256=dZa6zrypWBvpN8hd4qpxevvlyNFhxKINCg1537NJ36w,4318
|
|
13
13
|
manta_node/cli/version.py,sha256=L4lNTz-Uw_ejumy1tXJcJhcjhb-5FRcRQ6ogZM5N1Xo,5136
|
|
@@ -42,7 +42,7 @@ manta_node/infrastructure/metrics/__init__.py,sha256=ODGAj9s63F5jba2c3dQRMfNK6I4
|
|
|
42
42
|
manta_node/infrastructure/metrics/collector.py,sha256=9ESw__Pc2tV6ldG5yhos2IS7T5Td59KxTIwDRZc_G4w,3067
|
|
43
43
|
manta_node/infrastructure/metrics/metrics_collector.py,sha256=osIYrNzU3g9WCAxVQ14isM9YEQ3eJ7F3QgKBbpgeMJs,13077
|
|
44
44
|
manta_node/infrastructure/mqtt/__init__.py,sha256=riXo1sXgO4YV6DHCmWRqK61BAmuGLdHiVdQFunAJadA,140
|
|
45
|
-
manta_node/infrastructure/mqtt/command_handler.py,sha256=
|
|
45
|
+
manta_node/infrastructure/mqtt/command_handler.py,sha256=AmnDPc8OyIJ4xdoZURq_MU-jJrnTlD5DVk0xZCfn_10,43308
|
|
46
46
|
manta_node/infrastructure/network/__init__.py,sha256=On3XLgycFQoc-fBCa5hFuFDfEJjmFy7Wl2CK3D2LkdI,478
|
|
47
47
|
manta_node/infrastructure/network/event_registry.py,sha256=iWEfUJRzDnWjOrDinpYqVyIUpGKJjp7RZkjMDPfpplM,1661
|
|
48
48
|
manta_node/infrastructure/network/factory.py,sha256=-LvHbBp5nBpQ7fyQT1T0pvK3aczZqWc9QNDW37brBeU,3897
|
|
@@ -64,9 +64,9 @@ manta_node/supervisor/records.py,sha256=O1YjNN2bH1xzOJo_3l1G6FRvWo1CmdAfvSDJBj6s
|
|
|
64
64
|
manta_node/supervisor/seam.py,sha256=4kczRku5Ctn4xRvXS-pyzaDFau7LnX5bYOn6IRNKRyE,9665
|
|
65
65
|
manta_node/supervisor/sequence.py,sha256=eYu7rrk1ecc4Y2jQhhJ7CopPz3m0lOsFLJj5lT2PwBw,1685
|
|
66
66
|
manta_node/supervisor/switch.py,sha256=PbWLNnRwQFhOBDAUSLcDwZsIW5jPHq_zNKIyS7Hd8C0,22342
|
|
67
|
-
manta_node-0.6b6.
|
|
68
|
-
manta_node-0.6b6.
|
|
69
|
-
manta_node-0.6b6.
|
|
70
|
-
manta_node-0.6b6.
|
|
71
|
-
manta_node-0.6b6.
|
|
72
|
-
manta_node-0.6b6.
|
|
67
|
+
manta_node-0.6b6.dev855.dist-info/licenses/LICENSE,sha256=9mBgLhiB9goQPQjg9XQJ6FjgVxYw9Q8lyOZYkPGwF_c,34484
|
|
68
|
+
manta_node-0.6b6.dev855.dist-info/METADATA,sha256=s9x-_Y0FciTllbu44CSEgxX9TnUwLewVzkEgZhIHjYg,4937
|
|
69
|
+
manta_node-0.6b6.dev855.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
70
|
+
manta_node-0.6b6.dev855.dist-info/entry_points.txt,sha256=uCwggRApalLEsYs1YxwTBN0-e9oMJAkMoBp01HaSdoY,110
|
|
71
|
+
manta_node-0.6b6.dev855.dist-info/top_level.txt,sha256=nbT5J5WETuXM9UPoQckl29uUOq8wMYdRb9QDx5kAFeo,11
|
|
72
|
+
manta_node-0.6b6.dev855.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|