Skip to content

Commit

Permalink
Merge pull request #4539 from zenoss/bugfix/ZEN-35056.6x
Browse files Browse the repository at this point in the history
Skip device configs that fail to load.
  • Loading branch information
jpeacock-zenoss authored Sep 10, 2024
2 parents d199f44 + 1e6a3e8 commit 8e2e795
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Products/ZenCollector/services/ConfigCache.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ def remote_getDeviceConfigs(

return {
"new": [
self._stores.device.get(key).config for key in newest_keys
_get_configs(newest_keys, self._stores.device, self.log)
],
"updated": [
self._stores.device.get(key).config for key in updated_keys
_get_configs(updated_keys, self._stores.device, self.log)
],
"removed": list(removed),
}
Expand Down Expand Up @@ -195,6 +195,25 @@ def _filter(self, keys, predicate):
method("error filtering device ID %s", key.device)


def _get_configs(keys, store, log):
if log.isEnabledFor(logging.DEBUG):
mlog = log.exception
else:
mlog = log.error
for key in keys:
try:
yield store.get(key).config
except Exception as ex:
mlog(
"failed to retrieve config "
"error=%s service=%s collector=%s device=%s",
ex,
key.service,
key.monitor,
key.device,
)


class _DeviceProxy(object):
# The predicate returned by getOptionsFilter expects an object
# with an `id` attribute. So make a simple class with one attribute.
Expand Down

0 comments on commit 8e2e795

Please sign in to comment.