Skip to content

Commit

Permalink
Merge pull request #4471 from zenoss/bugfix/ZEN-34925.7x
Browse files Browse the repository at this point in the history
Generating keys for all config types is required for new devices.
  • Loading branch information
jpeacock-zenoss authored Jun 12, 2024
2 parents b028eca + c26f886 commit 52a50db
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions Products/ZenCollector/configcache/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@ def __init__(self, log, store, dispatcher):
self.dispatcher = dispatcher

def __call__(self, deviceId, monitor, buildlimit, newDevice=True):
all_keys = set(
CacheKey(svcname, monitor, deviceId)
for svcname in self.dispatcher.service_names
)
query = CacheQuery(device=deviceId, monitor=monitor)
pending_status = set()
other_status = set()
for status in self.store.query_statuses(query):
if isinstance(status, ConfigStatus.Pending):
pending_status.add(status.key)
else:
other_status.add(status.key)
for key in pending_status:
self.log.debug(
pending_keys = set(
status.key
for status in self.store.query_statuses(query)
if isinstance(status, ConfigStatus.Pending)
)
non_pending_keys = all_keys - pending_keys
for key in pending_keys:
self.log.info(
"build job already submitted for this config "
"device=%s collector=%s service=%s",
key.device,
Expand All @@ -40,9 +43,9 @@ def __call__(self, deviceId, monitor, buildlimit, newDevice=True):
)
now = time.time()
self.store.set_pending(
*((key, now) for key in other_status)
*((key, now) for key in non_pending_keys)
)
for key in other_status:
for key in non_pending_keys:
self.dispatcher.dispatch(
key.service, key.monitor, key.device, buildlimit, now
)
Expand Down Expand Up @@ -133,6 +136,7 @@ def __call__(self, deviceId, monitor, keys, buildlimit):
status.key
for key in noconfigkeys
for status in self.store.get_status(key)
if status is not None
)
now = time.time()
for key in (k for k in noconfigkeys if k not in skipkeys):
Expand Down

0 comments on commit 52a50db

Please sign in to comment.