Skip to content

Commit

Permalink
Fix filter dialect, adjust error messaging, add result output when av…
Browse files Browse the repository at this point in the history
…ailable
  • Loading branch information
jshcodes committed Nov 1, 2024
1 parent b6d2277 commit 1e1c6bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/rtr/queue_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def queue_command(**kwargs):
if not settings or "command" not in settings:
error_message = "".join(
[
"You must configure the 'cmd' argument within your "
"You must configure the 'command' argument within your "
"YAML file to proceed with this example."
]
)
Expand All @@ -49,7 +49,7 @@ def queue_command(**kwargs):
cmd: str = settings["command"]
logger.info("Running the command: %s", cmd)

filters = client.FalconFilter(dialect="rtr")
filters = client.FalconFilter(dialect="hosts")
filter_list: List[Dict] = settings.get("filters")
parse_filter_list(filter_list, filters)

Expand All @@ -76,7 +76,8 @@ def queue_command(**kwargs):

for device_id, device_result in batch_session.run_generic_command(cmd).items():
logger.info("[%s] Task queued: %s", device_id, device_result["task_id"])

if device_result.get("complete"):
print(device_result.get("stdout", device_result.get("stderr", "No output received")))

if __name__ in ["__main__", "examples.rtr.queue_command"]:
try:
Expand Down

0 comments on commit 1e1c6bc

Please sign in to comment.