-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
@@ -88,7 +92,9 @@ def __check_inventory(self): | |||
) | |||
|
|||
# update job when either inventory changes or config changes | |||
if server_config_modified or inventory_config_modified: | |||
if server_config_modified or inventory_config_modified or self._force_refresh: | |||
logger.info("Refreshing inventory and config") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add force_refresh state to that log to have more information
@@ -56,6 +56,10 @@ def __init__(self, args, server_config): | |||
self._local_snmp_engine = SnmpEngine() | |||
self._unmatched_devices = {} | |||
self._lock = threading.Lock() | |||
self._force_refresh = False | |||
|
|||
def force_inventory_refresh(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we change it and request in a few different scheduled functions, can't we run into any race condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boolean assignment is considered threadsafe in Python.
self._force_refresh = False - is the first statement in refreshing fragment of code so if other thread sets the flag to true it will be picked up during next iteration
refresh_inventory, | ||
inventory_file_path, | ||
) | ||
if not initial_walk: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we schedule automatic_realtime_task with False in __start_realtime_scheduler_task
wouldn't we schedule new jobs every time it will run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature of forcing inventory refreshing is supposed to be called when new walk for device was conducted and in case sysDescr has changed we would like run the matching again. When we start the application automatic_realtime_task is called to schedule first walk for device and there is no need to force inventory reloading.
Codecov Report
@@ Coverage Diff @@
## develop #149 +/- ##
===========================================
- Coverage 46.89% 46.61% -0.28%
===========================================
Files 22 22
Lines 1190 1195 +5
===========================================
- Hits 558 557 -1
- Misses 632 638 +6
Continue to review full report at Codecov.
|
…r-snmp-poller into feat/force_refresh � Conflicts: � splunk_connect_for_snmp_poller/manager/poller_utilities.py
Expected release notes (by @weliasz) features: fixes: others (will not be included in Semantic-Release notes):
|
🎉 This PR is included in version 1.5.0-develop.16 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Previously we used UNIX touch command to force refresh of inventory but as we have readonly filesystem on Kubernetes I redesigned this feature
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
I placed proper log entry and by updating record in Mongo I tricked our system to issue WALK command and inventory refresh. One need to put bigger value than existing in mongo for sysUpTime to trigger rewalk.
Checklist