Skip to content

Commit

Permalink
Merge pull request #25 from bertyah/master
Browse files Browse the repository at this point in the history
Fix oneshot parameters to actually work
  • Loading branch information
arm4b authored Dec 7, 2023
2 parents 06fde46 + c76b8ab commit 6bc01ba
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
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 to fix the ResultsReader deprecated function.

## 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.3.0
author : StackStorm, Inc.
email : [email protected]
python_versions:
Expand Down

0 comments on commit 6bc01ba

Please sign in to comment.