From 328d7da6581ddba93e8d69f21d6841cf99fe7591 Mon Sep 17 00:00:00 2001 From: 1yam <40899431+1yam@users.noreply.github.com> Date: Tue, 13 Aug 2024 14:34:03 +0200 Subject: [PATCH] Fix: check if requirements exist on message (#591) * Fix: check if requirements exist on message * Fix: adding check on node_hash also on instance parts --- src/aleph/handlers/content/vm.py | 2 +- tests/message_processing/test_process_instances.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aleph/handlers/content/vm.py b/src/aleph/handlers/content/vm.py index 8c37b633a..4a4229629 100644 --- a/src/aleph/handlers/content/vm.py +++ b/src/aleph/handlers/content/vm.py @@ -122,7 +122,7 @@ def _map_content_to_db_model(item_hash, content): if content.environment.trusted_execution is not None: trusted_execution_policy = content.environment.trusted_execution.policy trusted_execution_firmware = content.environment.trusted_execution.firmware - if hasattr(content.requirements.node, 'node_hash'): + if hasattr(content, "requirements") and hasattr(content.requirements.node, 'node_hash'): node_hash = content.requirements.node.node_hash return db_cls( diff --git a/tests/message_processing/test_process_instances.py b/tests/message_processing/test_process_instances.py index 2cc1259dd..2078d696c 100644 --- a/tests/message_processing/test_process_instances.py +++ b/tests/message_processing/test_process_instances.py @@ -306,8 +306,8 @@ async def test_process_instance( ) assert rootfs.size_mib == content_dict["rootfs"]["size_mib"] assert rootfs.persistence == content_dict["rootfs"]["persistence"] - assert len(instance.volumes) == 5 + assert instance.node_hash is None volumes_by_type = { type: list(volumes_iter)