Skip to content

Commit 862d295

Browse files
committed
Fixed up code-blocks
Also fixed command.conf spelling of "retainsevents" (not "retains events")
1 parent d245561 commit 862d295

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

splunklib/searchcommands/decorators.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,9 @@ class Option(property):
229229
230230
Short form (recommended). When you are satisfied with built-in or custom validation behaviors.
231231
232-
.. code-block:: python
232+
.. code-block:: python
233233
:linenos:
234+
234235
from splunklib.searchcommands.decorators import Option
235236
from splunklib.searchcommands.validators import Fieldname
236237
@@ -247,8 +248,9 @@ class Option(property):
247248
also provide a deleter. You must be prepared to accept a value of :const:`None` which indicates that your
248249
:code:`Option` is unset.
249250
250-
.. code-block:: python
251+
.. code-block:: python
251252
:linenos:
253+
252254
from splunklib.searchcommands import Option
253255
254256
@Option()

splunklib/searchcommands/generating_command.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ class StreamingGeneratingCommand(GeneratingCommand)
9292
+==========+===================================================+===================================================+
9393
| streams | 1. Add this line to your command's stanza in | 1. Add this configuration setting to your code: |
9494
| | | |
95-
| | default/commands.conf. | .. code-block:: python |
96-
| | .. code-block:: python | @Configuration(distributed=True) |
97-
| | local = false | class SomeCommand(GeneratingCommand) |
95+
| | default/commands.conf:: | .. code-block:: python |
96+
| | | |
97+
| | local = false | @Configuration(distributed=True) |
98+
| | | class SomeCommand(GeneratingCommand) |
9899
| | | ... |
99100
| | 2. Restart splunk | |
100101
| | | 2. You are good to go; no need to restart Splunk |
@@ -112,29 +113,33 @@ class StreamingGeneratingCommand(GeneratingCommand)
112113
| | settings to your command class: | setting to your command class: |
113114
| | | |
114115
| | .. code-block:: python | .. code-block:: python |
116+
| | | |
115117
| | @Configuration( | @Configuration(type='events') |
116118
| | retainsevents=True, streaming=False) | class SomeCommand(GeneratingCommand) |
117119
| | class SomeCommand(GeneratingCommand) | ... |
118120
| | ... | |
119121
| | | |
120122
| | Or add these lines to default/commands.conf: | |
121123
| | | |
122-
| | .. code-block:: | |
123-
| | retains events = true | |
124+
| | .. code-block:: text | |
125+
| | | |
126+
| | retainsevents = true | |
124127
| | streaming = false | |
125128
+----------+---------------------------------------------------+---------------------------------------------------+
126129
127130
Configure your command class like this, if you wish to support both protocols:
128131
129-
.. code-block:: python
132+
.. code-block:: python
133+
130134
@Configuration(type='events', retainsevents=True, streaming=False)
131135
class SomeCommand(GeneratingCommand)
132136
...
133137
134138
You might also consider adding these lines to commands.conf instead of adding them to your command class:
135139
136-
.. code-block:: python
137-
retains events = false
140+
.. code-block:: python
141+
142+
retainsevents = false
138143
streaming = false
139144
140145
Reporting Generating command
@@ -149,28 +154,32 @@ class SomeCommand(GeneratingCommand)
149154
| | settings to your command class: | setting to your command class: |
150155
| | | |
151156
| | .. code-block:: python | .. code-block:: python |
157+
| | | |
152158
| | @Configuration(retainsevents=False) | @Configuration(type='reporting') |
153159
| | class SomeCommand(GeneratingCommand) | class SomeCommand(GeneratingCommand) |
154160
| | ... | ... |
155161
| | | |
156162
| | Or add this lines to default/commands.conf: | |
157163
| | | |
158-
| | .. code-block:: | |
159-
| | retains events = false | |
164+
| | .. code-block:: text | |
165+
| | | |
166+
| | retainsevents = false | |
160167
| | streaming = false | |
161168
+----------+---------------------------------------------------+---------------------------------------------------+
162169
163170
Configure your command class like this, if you wish to support both protocols:
164171
165-
.. code-block:: python
172+
.. code-block:: python
173+
166174
@Configuration(type='reporting', streaming=False)
167175
class SomeCommand(GeneratingCommand)
168176
...
169177
170178
You might also consider adding these lines to commands.conf instead of adding them to your command class:
171179
172-
.. code-block:: python
173-
retains events = false
180+
.. code-block:: text
181+
182+
retainsevents = false
174183
streaming = false
175184
176185
"""

splunklib/searchcommands/search_command.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ def service(self):
338338
specifying this pair of configuration settings in commands.conf:
339339
340340
.. code-block:: python
341+
341342
enableheader = true
342343
requires_srinfo = true
343344
@@ -1080,7 +1081,7 @@ def dispatch(command_class, argv=sys.argv, input_file=sys.stdin, output_file=sys
10801081
10811082
**Example**
10821083
1083-
.. code-block:: python
1084+
.. code-block:: python
10841085
:linenos:
10851086
10861087
#!/usr/bin/env python
@@ -1096,7 +1097,7 @@ def stream(records):
10961097
10971098
**Example**
10981099
1099-
.. code-block:: python
1100+
.. code-block:: python
11001101
:linenos:
11011102
11021103
from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators

0 commit comments

Comments
 (0)