Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix oneshot parameters to actually work #25

Merged
merged 5 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 2.3.0

- Refactor params for Oneshot search
- Change ResultReader to JSONResultReader
arm4b marked this conversation as resolved.
Show resolved Hide resolved

## 2.2.0

- Add `count` parameter to Oneshot search
Expand Down
6 changes: 3 additions & 3 deletions actions/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, config):
else:
raise ValueError("No Splunk configuration details found")

def run(self, instance, query, count):
def run(self, instance, query, count, offset):
"""stackstorm run method"""
# Find config details
if instance:
Expand Down Expand Up @@ -52,8 +52,8 @@ def run(self, instance, query, count):
"Failed to connect to Splunk Instance {} with error {}".format(splunk_config, err)
)

result = self.service.jobs.oneshot(query, params={"output_mode": "json", "count": count})
reader = results.ResultsReader(result)
result = self.service.jobs.oneshot(query, count=count, offset=offset, output_mode='json')
reader = results.JSONResultsReader(result)
search_results = []

for item in reader:
Expand Down
6 changes: 6 additions & 0 deletions actions/search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ parameters:
required: true
position: 2
default: 100
offset:
type: integer
description: "A number that specifies the index of the first entity to return"
required: true
position: 3
default: 0
2 changes: 1 addition & 1 deletion pack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- splunk
- monitoring
- alerting
version: 2.2.0
version: 2.2.1
bertyah marked this conversation as resolved.
Show resolved Hide resolved
author : StackStorm, Inc.
email : [email protected]
python_versions:
Expand Down
Loading