Skip to content

Commit

Permalink
[mordred] Fix periodic autorefresh
Browse files Browse the repository at this point in the history
This commit fixes the global task autorefresh. It was not refreshing
the identities from backend sections that included ':' in their name.

Signed-off-by: Jose Javier Merchante <[email protected]>
  • Loading branch information
jjmerchante committed Nov 3, 2023
1 parent 97bac1c commit 1022a29
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions releases/unreleased/periodic-autorefresh-not-working.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Periodic autorefresh not working
category: fixed
author: Jose Javier Merchante <[email protected]>
issue: null
notes: >
Periodic refresh of identities was not working for backend sections that
included `:` in their name.
8 changes: 5 additions & 3 deletions sirmordred/task_autorefresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def _get_backend_sections(self):
for pro in projects:
for sect in projects[pro].keys():
for backend_section in Config.get_backend_sections():
if sect.startswith(backend_section) and backend_section in self.conf:
backends.append(backend_section)
if sect.startswith(backend_section) and sect in self.conf:
backends.append(sect)

# Remove duplicates
backends = list(set(backends))
Expand Down Expand Up @@ -95,7 +95,9 @@ def __autorefresh(self, enrich_backend, backend_section, after):
def __autorefresh_areas_of_code(self, after):
"""Execute autorefresh for areas of code study if configured"""

if 'studies' not in self.conf['git'] or 'enrich_areas_of_code:git' not in self.conf['git']['studies']:
if 'git' not in self.conf or \
'studies' not in self.conf['git'] or \
'enrich_areas_of_code:git' not in self.conf['git']['studies']:
logger.info("Not doing autorefresh for studies, Areas of Code study is not active.")
return

Expand Down

0 comments on commit 1022a29

Please sign in to comment.