From 1d9dc698d110f0336bddede8beeb856fadca6679 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Mon, 12 Jun 2017 10:56:41 -0700 Subject: [PATCH 1/3] SPL-142009: Splunk SDK for python was expecting wrong value of type='eventing', whereas it should have been 'type=events', which is in consistency with splunk code. --- splunklib/searchcommands/generating_command.py | 8 ++++---- splunklib/searchcommands/internals.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/splunklib/searchcommands/generating_command.py b/splunklib/searchcommands/generating_command.py index 3bd019231..3a20e60ea 100644 --- a/splunklib/searchcommands/generating_command.py +++ b/splunklib/searchcommands/generating_command.py @@ -56,7 +56,7 @@ class GeneratingCommand(SearchCommand): +==========+=====================================+============================================+ | streams | streaming=True[,local=[True|False]] | type='streaming'[,distributed=[true|false] | +----------+-------------------------------------+--------------------------------------------+ - | events | retainsevents=True, streaming=False | type='eventing' | + | events | retainsevents=True, streaming=False | type='events' | +----------+-------------------------------------+--------------------------------------------+ | reports | streaming=False | type='reporting' | +----------+-------------------------------------+--------------------------------------------+ @@ -112,7 +112,7 @@ class StreamingGeneratingCommand(GeneratingCommand) | | settings to your command class: | setting to your command class: | | | | | | | .. code-block:: python | .. code-block:: python | - | | @Configuration( | @Configuration(type='eventing') | + | | @Configuration( | @Configuration(type='events') | | | retainsevents=True, streaming=False) | class SomeCommand(GeneratingCommand) | | | class SomeCommand(GeneratingCommand) | ... | | | ... | | @@ -127,7 +127,7 @@ class StreamingGeneratingCommand(GeneratingCommand) Configure your command class like this, if you wish to support both protocols: .. code-block:: python - @Configuration(type='eventing', retainsevents=True, streaming=False) + @Configuration(type='events', retainsevents=True, streaming=False) class SomeCommand(GeneratingCommand) ... @@ -280,7 +280,7 @@ class ConfigurationSettings(SearchCommand.ConfigurationSettings): ==================== ====================================================================================== Value Description -------------------- -------------------------------------------------------------------------------------- - :const:`'eventing'` Runs as the first command in the Splunk events pipeline. Cannot be distributed. + :const:`'events'` Runs as the first command in the Splunk events pipeline. Cannot be distributed. :const:`'reporting'` Runs as the first command in the Splunk reports pipeline. Cannot be distributed. :const:`'streaming'` Runs as the first command in the Splunk streams pipeline. May be distributed. ==================== ====================================================================================== diff --git a/splunklib/searchcommands/internals.py b/splunklib/searchcommands/internals.py index be57703eb..fffc00b7d 100644 --- a/splunklib/searchcommands/internals.py +++ b/splunklib/searchcommands/internals.py @@ -326,7 +326,7 @@ def validate_configuration_setting(specification, name, value): supporting_protocols=[1, 2]), 'type': specification( type=(bytes, unicode), - constraint=lambda value: value in ('eventing', 'reporting', 'streaming'), + constraint=lambda value: value in ('events', 'reporting', 'streaming'), supporting_protocols=[2])} From c4fb8ecd69fede8de6dbc03cc897028182eed0ad Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Mon, 12 Jun 2017 15:21:39 -0700 Subject: [PATCH 2/3] SPL-142009: Some more changes to fix test cases. --- examples/searchcommands_app/package/default/searchbnf.conf | 2 +- splunklib/searchcommands/eventing_command.py | 4 ++-- tests/searchcommands/test_configuration_settings.py | 2 +- tests/searchcommands/test_decorators.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/searchcommands_app/package/default/searchbnf.conf b/examples/searchcommands_app/package/default/searchbnf.conf index 7f9ce54ca..b31a12941 100644 --- a/examples/searchcommands_app/package/default/searchbnf.conf +++ b/examples/searchcommands_app/package/default/searchbnf.conf @@ -36,7 +36,7 @@ comment1 = \ example1 = \ | generatetext text="Hello world! How the heck are you?" count=6 \ | filter predicate="(long(_serial) & 1) == 0" map="_raw = _raw.replace('world', 'Splunk')" -category = eventing +category = events appears-in = 1.5 maintainer = dnoble usage = public diff --git a/splunklib/searchcommands/eventing_command.py b/splunklib/searchcommands/eventing_command.py index fde7aadbc..3a054fa42 100644 --- a/splunklib/searchcommands/eventing_command.py +++ b/splunklib/searchcommands/eventing_command.py @@ -113,10 +113,10 @@ class ConfigurationSettings(SearchCommand.ConfigurationSettings): ''') - type = ConfigurationSetting(readonly=True, value='eventing', doc=''' + type = ConfigurationSetting(readonly=True, value='events', doc=''' Command type - Fixed: :const:`'eventing'`. + Fixed: :const:`'events'`. Supported by: SCP 2 diff --git a/tests/searchcommands/test_configuration_settings.py b/tests/searchcommands/test_configuration_settings.py index d44db0b72..aca97df1a 100644 --- a/tests/searchcommands/test_configuration_settings.py +++ b/tests/searchcommands/test_configuration_settings.py @@ -155,7 +155,7 @@ def stream(self, records): command.configuration.required_fields = ['field_1', 'field_2', 'field_3'] try: - command.configuration.type = 'eventing' + command.configuration.type = 'events' except AttributeError: pass except Exception as error: diff --git a/tests/searchcommands/test_decorators.py b/tests/searchcommands/test_decorators.py index a105d3a12..4cf393551 100755 --- a/tests/searchcommands/test_decorators.py +++ b/tests/searchcommands/test_decorators.py @@ -252,7 +252,7 @@ def fix_up(cls, command_class): ('some unicode string', b'some byte string'), (None, 0xdead)), ('type', - ('eventing', 'reporting', 'streaming', b'eventing', b'reporting', b'streaming'), + ('events', 'reporting', 'streaming', b'events', b'reporting', b'streaming'), ('events', 0xdead))): for value in values: From fdaf4b80edf192148701e85c3aee3d707b4fa594 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Mon, 12 Jun 2017 18:22:14 -0700 Subject: [PATCH 3/3] SPL-142009: Fixed failing test case. --- tests/searchcommands/test_decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/searchcommands/test_decorators.py b/tests/searchcommands/test_decorators.py index 4cf393551..eab284341 100755 --- a/tests/searchcommands/test_decorators.py +++ b/tests/searchcommands/test_decorators.py @@ -253,7 +253,7 @@ def fix_up(cls, command_class): (None, 0xdead)), ('type', ('events', 'reporting', 'streaming', b'events', b'reporting', b'streaming'), - ('events', 0xdead))): + ('eventing', 0xdead))): for value in values: