From 9a82e467997cbfaac40366b89497da2d41f78786 Mon Sep 17 00:00:00 2001 From: vakarisz Date: Fri, 30 Sep 2022 11:39:52 +0300 Subject: [PATCH] Island: Make machine model hashable Machines can be hashed based on their ID. This allows us to add them to set for example and make sure no duplicate entries are there --- monkey/monkey_island/cc/models/machine.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/monkey/monkey_island/cc/models/machine.py b/monkey/monkey_island/cc/models/machine.py index 99d4ae5eb..ece877b9e 100644 --- a/monkey/monkey_island/cc/models/machine.py +++ b/monkey/monkey_island/cc/models/machine.py @@ -38,3 +38,6 @@ class Machine(MutableInfectionMonkeyBaseModel): _make_immutable_sequence = validator("network_interfaces", pre=True, allow_reuse=True)( make_immutable_sequence ) + + def __hash__(self): + return self.id