Commit 1d1a3455 authored by Andrea Sgambelluri's avatar Andrea Sgambelluri
Browse files

service: skip devices without an optical configuration when provisioning

A computed path can cross emulated devices that never ran optical
discovery, so Context holds no configuration for them and
SelectOpticalConfig returns an empty one. Parsing that raised
"Expecting value: line 1 column 1" and abandoned the remaining devices
on the path. Both the point-to-point and point-to-multipoint
configuration paths are affected.

Relates to #316
parent 3f0e90b4
Loading
Loading
Loading
Loading
+18 −0
Changes for src/service/service/task_scheduler/TaskExecutor.py: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -161,6 +161,15 @@ class TaskExecutor:
        try:
            result = self._context_client.SelectOpticalConfig(optical_config_id)

            if result is None or not result.config:
                # A computed path can cross emulated devices that never ran
                # optical discovery, so Context holds no configuration for
                # them and there is nothing to update.
                LOGGER.info(
                    "No optical configuration stored for device %s; skipping it.",
                    device.name,
                )
                return
            new_config = json.loads(result.config)
            LOGGER.info("new_config %s", new_config)
            if is_opticalband : new_config['connection_uuid']=connection_uuid
@@ -243,6 +252,15 @@ class TaskExecutor:
        try:
            result = self._context_client.SelectOpticalConfig(optical_config_id)

            if result is None or not result.config:
                # A computed path can cross emulated devices that never ran
                # optical discovery, so Context holds no configuration for
                # them and there is nothing to update.
                LOGGER.info(
                    "No optical configuration stored for device %s; skipping it.",
                    device.name,
                )
                return
            new_config = json.loads(result.config)
            LOGGER.info("new_config %s", new_config)
            if 'type' in new_config: