Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
fix: profiles are now loaded from file every time
Browse files Browse the repository at this point in the history
  • Loading branch information
weliasz committed Oct 22, 2021
1 parent d69a9c7 commit 93a5492
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions splunk_connect_for_snmp_poller/manager/poller.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def __check_inventory(self):
def delete_all_entries_per_host(self, host):
for entry_key in list(self._jobs_map.keys()):
if entry_key.split("#")[0] == host:
logger.debug("Removing job for %s", entry_key)
schedule.cancel_job(self._jobs_map.get(entry_key))
del self._jobs_map[entry_key]

Expand Down Expand Up @@ -229,7 +230,7 @@ def __start_realtime_scheduler_task(self):

schedule.every(self._args.matching_task_frequency).seconds.do(
self.process_unmatched_devices_job,
self._server_config,
self._args.config,
)

automatic_realtime_job(
Expand All @@ -253,15 +254,16 @@ def add_device_for_profile_matching(self, device: InventoryRecord):
self._unmatched_devices[device.host] = device
self._lock.release()

def process_unmatched_devices_job(self, server_config):
def process_unmatched_devices_job(self, config_location):
job_thread = threading.Thread(
target=self.process_unmatched_devices, args=[server_config]
target=self.process_unmatched_devices, args=[config_location]
)
job_thread.start()

def process_unmatched_devices(self, server_config):
def process_unmatched_devices(self, config_location):
if self._unmatched_devices:
try:
server_config = parse_config_file(config_location)
profiles = get_profiles(server_config)
self._lock.acquire()
processed_devices = set()
Expand Down

0 comments on commit 93a5492

Please sign in to comment.