Skip to content

SearchCommand #105

@rhaarm

Description

@rhaarm

I tried to see if there was an issue already for this, but couldn't find one. I'm seeing a lot of errors in the test runs with errors coming from search_command.py & SearchCommand. After using PyCharm inspection it looks like there is type(self).name being referenced but never declared. I would edit this myself, but not sure what the self.name is referencing, maybe SearchCommand.name?

    def __str__(self):
        values = [type(self).name, str(self.options)] + self.fieldnames
        text = ' '.join([value for value in values if len(value) > 0])
        return text

Also it maybe safe to move these from init into the class declaration, since the displayed stacktrace shows that the self.option cannot find self._option_view.

class SearchCommand(object): 
       def __init__(self):
              self._configuration = None
              self._fieldnames = None
              self._option_view = None
              self._output_file = None
              self._search_results_info = None
              self._service = None
class SearchCommand(object): 
       _configuration = None
        _fieldnames = None
        _option_view = None
        _output_file = None
        _search_results_info = None
        _service = None

       def __init__(self):
Logged from file search_command.py, line 60
.Traceback (most recent call last):
  File "D:\Python27\Lib\logging\__init__.py", line 859, in emit
    msg = self.format(record)
  File "D:\Python27\Lib\logging\__init__.py", line 732, in format
    return fmt.format(record)
  File "D:\Python27\Lib\logging\__init__.py", line 471, in format
    record.message = record.getMessage()
  File "D:\Python27\Lib\logging\__init__.py", line 335, in getMessage
    msg = msg % self.args
  File "d:\code\splunk-sdk-python\splunklib\searchcommands\search_command.py", line 78, in __str__
    values = [type(self).name, str(self.options)] + self.fieldnames
  File "d:\code\splunk-sdk-python\splunklib\searchcommands\search_command.py", line 164, in options
    if self._option_view is None:
AttributeError: 'StubbedGeneratingCommand' object has no attribute '_option_view'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions