condition check
@@ -190,6 +190,9 @@ class Update_Switch_State(Monitor_Helper_Base):
for machine in machines:
end_point = EndPoint(machine, state='UNKNOWN')
h = end_point.make_hash()
+ ep = None
+ if h in self.endpoints.state:
+ ep = self.endpoints.state[h]
if end_point.endpoint_data['active'] == 1:
machine_hashes.append(h)
@@ -198,7 +201,7 @@ class Update_Switch_State(Monitor_Helper_Base):
'***** detected new address {0}'.format(machine))
self.endpoints.set(end_point)
changed = True
- elif end_point.endpoint_data['active'] != self.endpoints.state[h].endpoint_data['active']:
+ elif ep is not None and end_point.endpoint_data['active'] != ep.endpoint_data['active']:
self.endpoints.set(end_point)
changed = True
if changed:
