Skip to content

Commit

Permalink
Fix: check if requirements exist on message (#591)
Browse files Browse the repository at this point in the history
* Fix: check if requirements exist on message

* Fix: adding check on node_hash also on instance parts
  • Loading branch information
1yam authored Aug 13, 2024
1 parent 0e44b8e commit 328d7da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/aleph/handlers/content/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tests/message_processing/test_process_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 328d7da

Please sign in to comment.