Skip to content

Commit 81b5d3f

Browse files
author
Ke Li
committed
Fix 'maxresultrows' extraction bug
1 parent ceba6a0 commit 81b5d3f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

splunklib/searchcommands/search_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ def _process_protocol_v2(self, argv, ifile, ofile):
684684
# Write search command configuration for consumption by splunkd
685685
# noinspection PyBroadException
686686
try:
687-
self._record_writer = RecordWriterV2(ofile, getattr(self._metadata, 'maxresultrows', None))
687+
self._record_writer = RecordWriterV2(ofile, getattr(self._metadata.searchinfo, 'maxresultrows', None))
688688
self.fieldnames = []
689689
self.options.reset()
690690

tests/searchcommands/test_search_command.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,9 @@ def test_process_scpv2(self):
378378
'"show_configuration={show_configuration}",'
379379
'"required_option_1=value_1",'
380380
'"required_option_2=value_2"'
381-
']'
381+
'],'
382+
'"maxresultrows": 10,'
383+
'"command": "countmatches"'
382384
'}}'
383385
'}}')
384386

@@ -472,6 +474,8 @@ def test_process_scpv2(self):
472474
self.assertEqual(command_metadata.searchinfo.splunk_version, '20150522')
473475
self.assertEqual(command_metadata.searchinfo.splunkd_uri, 'https://127.0.0.1:8089')
474476
self.assertEqual(command_metadata.searchinfo.username, 'admin')
477+
self.assertEqual(command_metadata.searchinfo.maxresultrows, 10)
478+
self.assertEqual(command_metadata.searchinfo.command, 'countmatches')
475479

476480
command.search_results_info.search_metrics = command.search_results_info.search_metrics.__dict__
477481
command.search_results_info.optional_fields_json = command.search_results_info.optional_fields_json.__dict__

0 commit comments

Comments
 (0)