Skip to content

Commit

Permalink
[AAP-9218] Honor limit set in run_job_template's job_args.limit field (
Browse files Browse the repository at this point in the history
…#362)

hosts defined in this field should overwrite rulebook's hosts field but
yield to hosts in event's meta field

Resolves AAP-9218
bzwei authored Feb 13, 2023
2 parents 109cd52 + 459c073 commit 886e71b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ansible_rulebook/engine.py
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
from pprint import PrettyPrinter, pformat
from typing import Any, Dict, List, Optional, cast

import dpath
from drools import ruleset as lang
from drools.dispatch import establish_async_channel, handle_async_messages
from drools.exceptions import (
@@ -362,6 +363,17 @@ async def _call_action(
result = None
if action in builtin_actions:
try:
if action == "run_job_template":
limit = dpath.get(
action_args,
"job_args.limit",
separator=".",
default=None,
)
if isinstance(limit, list):
hosts = limit
elif isinstance(limit, str):
hosts = [limit]
single_match = None
keys = list(rules_engine_result.data.keys())
if len(keys) == 0:

0 comments on commit 886e71b

Please sign in to comment.