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 11, 2022
1 parent 356af8e commit 8b9d789
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 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,15 @@ def run(self, labels: list, analysis_id=None):
runtime_environments = [
e["name"] for e in thoth_config["runtime_environments"]
]
managers = thoth_config.get("managers")
disallow_run_times = managers[0].get("disallow", None)
allowed_run_times = managers[0].get("allow", None)
if disallow_run_times:
runtime_environments = list(
set(runtime_environments) ^ set(disallow_run_times)
)
if allowed_run_times:
runtime_environments = allowed_run_times
else:
runtime_environments = [
thoth_config["runtime_environments"][0]["name"]
Expand Down
9 changes: 9 additions & 0 deletions kebechet/managers/update/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,15 @@ def run(self, labels: list = []) -> Optional[dict]:
else:
runtime_environments = [None]

managers = thoth_config.content.get("managers")
disallow_run_times = managers[0].get("disallow", None)
allowed_run_times = managers[0].get("allow", None)
if disallow_run_times:
runtime_environments = list(
set(runtime_environments) ^ set(disallow_run_times)
)
if allowed_run_times:
runtime_environments = allowed_run_times
results: dict = {}
for e in runtime_environments:
self.runtime_environment = e or "default"
Expand Down

0 comments on commit 8b9d789

Please sign in to comment.