From a98a801b4911689dfed2b9588a93a1d94d5e6e99 Mon Sep 17 00:00:00 2001 From: Emil Svendsen Date: Fri, 21 Aug 2026 11:28:53 +0200 Subject: [PATCH] resource/remote: handle unknown resource Instead of failing to create a RemotePlaceManager print out a warning on unknown remote resources and continue. This will allow use of standard tools like labgrid-client's console together with a remote place where some of its resources are unknown/custom. Signed-off-by: Emil Svendsen --- labgrid/resource/remote.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/labgrid/resource/remote.py b/labgrid/resource/remote.py index bbe13aaa2..98ff1118a 100644 --- a/labgrid/resource/remote.py +++ b/labgrid/resource/remote.py @@ -3,6 +3,7 @@ import attr from ..factory import target_factory +from ..exceptions import InvalidConfigError from .common import NetworkResource, ManagedResource, ResourceManager @@ -47,8 +48,13 @@ def on_resource_added(self, resource): resource_entries = self.session.get_target_resources(place) # pylint: disable=no-member expanded = [] for (resource_name, _), resource_entry in resource_entries.items(): - new = target_factory.make_resource( - remote_place.target, resource_entry.cls, resource_name, resource_entry.args) + try: + new = target_factory.make_resource( + remote_place.target, resource_entry.cls, resource_name, resource_entry.args) + except InvalidConfigError: + self.logger.warning("unknown resource cls: %s, name: %s", resource_entry.cls, resource_name) + continue + new.parent = remote_place new.avail = resource_entry.avail new.extra = resource_entry.extra