Skip to content

Commit

Permalink
Add 'allow' and 'disallow' setting to each manager
Browse files Browse the repository at this point in the history
Signed-off-by: Shreekara <sshreeka@redhat.com>
  • Loading branch information
shreekarSS committed Oct 12, 2022
1 parent 356af8e commit 651f148
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
15 changes: 15 additions & 0 deletions kebechet/managers/thoth_advise/thoth_advise.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,21 @@ def run(self, labels: list, analysis_id=None):
runtime_environments = [
e["name"] for e in thoth_config["runtime_environments"]
]
managers = thoth_config.get("managers")
for mgr in managers:
if mgr.get("name") == "thoth-advise":
disallow_run_times = mgr.get("disallow", None)
allowed_run_times = mgr.get("allow", None)
if disallow_run_times:
runtime_environments = list(
set(runtime_environments) - set(disallow_run_times)
)
if allowed_run_times:
runtime_environments = list(
set(runtime_environments).intersection(
set(allowed_run_times)
)
)
else:
runtime_environments = [
thoth_config["runtime_environments"][0]["name"]
Expand Down
13 changes: 13 additions & 0 deletions kebechet/managers/update/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,19 @@ def run(self, labels: list = []) -> Optional[dict]:
else:
runtime_environments = [None]

managers = thoth_config.content.get("managers")
for mgr in managers:
if mgr.get("name") == "update":
disallow_run_times = mgr.get("disallow", None)
allowed_run_times = mgr.get("allow", None)
if disallow_run_times:
runtime_environments = list(
set(runtime_environments) - set(disallow_run_times)
)
if allowed_run_times:
runtime_environments = list(
set(runtime_environments).intersection(set(allowed_run_times))
)
results: dict = {}
for e in runtime_environments:
self.runtime_environment = e or "default"
Expand Down

0 comments on commit 651f148

Please sign in to comment.