-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagent_whitelist.py
37 lines (30 loc) · 1.03 KB
/
agent_whitelist.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
__author__ = "Adam Preble"
__copyright__ = "Copyright 2016, Adam Preble"
__credits__ = ["Adam Preble"]
__license__ = "personal"
__version__ = "1.0.0"
__maintainer__ = "Adam Preble"
__email__ = "[email protected]"
__status__ = "Demonstration"
class AgentWhitelist(object):
"""
A basic whitelist for the Gatherer to track which monitors have connected and which ones we might care about.
"""
def __init__(self, starter_whitelist=[]):
self.whitelist = starter_whitelist
self.reported = []
def add_necessary(self, necessary):
if not necessary in self.whitelist:
self.whitelist.append(necessary)
def clear_whitelist(self):
self.whitelist = []
def reset_reported(self):
self.reported = []
def all_reported(self):
for needed in self.whitelist:
if not needed in self.reported:
return False
return True
def add_reported(self, reported):
if not reported in self.reported:
self.reported.append(reported)