diff options
| author | Scott Gasch <[email protected]> | 2021-11-01 14:10:02 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2021-11-01 14:10:02 -0700 |
| commit | acacd9d2e942d084631e99e94ee430fd26ae9893 (patch) | |
| tree | 56bedbc8b3237a6f10264f3b448a176bcdcb89ab /arper.py | |
| parent | eb9e6df32ed696158bf34dba6464277b648f5c74 (diff) | |
Overrides + debugging modules / functions in logging.
Diffstat (limited to 'arper.py')
| -rw-r--r-- | arper.py | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -78,23 +78,6 @@ class Arper(persistent.Persistent): def get_mac_by_ip(self, ip: str) -> Optional[str]: return self.state.inverse.get(ip, None) - @overrides - def save(self) -> bool: - if len(self.state) > config.config['arper_min_entries_to_be_valid']: - logger.debug( - f'Persisting state to {config.config["arper_cache_location"]}' - ) - with file_utils.FileWriter(config.config['arper_cache_location']) as wf: - for (mac, ip) in self.state.items(): - mac = mac.lower() - print(f'{mac}, {ip}', file=wf) - return True - else: - logger.warning( - f'Only saw {len(self.state)} entries; needed at least {config.config["arper_min_entries_to_be_valid"]} to bother persisting.' - ) - return False - @classmethod @overrides def load(cls) -> Any: @@ -125,3 +108,20 @@ class Arper(persistent.Persistent): logger.debug('No usable saved state found') return None + + @overrides + def save(self) -> bool: + if len(self.state) > config.config['arper_min_entries_to_be_valid']: + logger.debug( + f'Persisting state to {config.config["arper_cache_location"]}' + ) + with file_utils.FileWriter(config.config['arper_cache_location']) as wf: + for (mac, ip) in self.state.items(): + mac = mac.lower() + print(f'{mac}, {ip}', file=wf) + return True + else: + logger.warning( + f'Only saw {len(self.state)} entries; needed at least {config.config["arper_min_entries_to_be_valid"]} to bother persisting.' + ) + return False |
