diff --git a/splunklib/searchcommands/generating_command.py b/splunklib/searchcommands/generating_command.py index 3bd019231..3a78ada38 100644 --- a/splunklib/searchcommands/generating_command.py +++ b/splunklib/searchcommands/generating_command.py @@ -308,7 +308,7 @@ def iteritems(self): version = self.command.protocol_version if version == 2: iteritems = ifilter(lambda (name, value): name != 'distributed', iteritems) - if self.distributed and self.type == 'streaming': + if not self.distributed and self.type == 'streaming': iteritems = imap( lambda (name, value): (name, 'stateful') if name == 'type' else (name, value), iteritems) return iteritems diff --git a/splunklib/searchcommands/streaming_command.py b/splunklib/searchcommands/streaming_command.py index 12e9f035d..0b0aa2404 100644 --- a/splunklib/searchcommands/streaming_command.py +++ b/splunklib/searchcommands/streaming_command.py @@ -180,7 +180,7 @@ def iteritems(self): iteritems = ifilter(lambda (name, value): name != 'clear_required_fields', iteritems) else: iteritems = ifilter(lambda (name, value): name != 'distributed', iteritems) - if self.distributed: + if not self.distributed: iteritems = imap( lambda (name, value): (name, 'stateful') if name == 'type' else (name, value), iteritems) return iteritems diff --git a/tests/searchcommands/test_configuration_settings.py b/tests/searchcommands/test_configuration_settings.py index d44db0b72..c02e2dac2 100644 --- a/tests/searchcommands/test_configuration_settings.py +++ b/tests/searchcommands/test_configuration_settings.py @@ -81,7 +81,7 @@ def generate(self): self.assertIs(command.configuration.distributed, False) self.assertIs(command.configuration.generating, True) - self.assertEqual(command.configuration.type, 'streaming') + self.assertEqual(command.configuration.type, 'stateful') command.configuration.distributed = True @@ -96,7 +96,7 @@ def generate(self): self.assertEqual( [(name, value) for name, value in command.configuration.iteritems()], - [('generating', True), ('type', 'stateful')]) + [('generating', True), ('type', 'streaming')]) return