diff --git a/spyglass/cli.py b/spyglass/cli.py index c5d53d3..ec40b73 100644 --- a/spyglass/cli.py +++ b/spyglass/cli.py @@ -91,9 +91,7 @@ def intermediary_processor(plugin_type, **kwargs): # Extract data from plugin data source LOG.info("Extract data from plugin data source") - data_extractor = plugin_class(kwargs['site_name']) - plugin_conf = data_extractor.get_plugin_conf(**kwargs) - data_extractor.set_config_opts(plugin_conf) + data_extractor = plugin_class(kwargs['site_name'], **kwargs) data_extractor.extract_data() # Apply any additional_config provided by user diff --git a/spyglass/data_extractor/base.py b/spyglass/data_extractor/base.py index d1c25f7..5b5baef 100755 --- a/spyglass/data_extractor/base.py +++ b/spyglass/data_extractor/base.py @@ -23,40 +23,12 @@ LOG = logging.getLogger(__name__) class BaseDataSourcePlugin(metaclass=abc.ABCMeta): """Provide basic hooks for data source plugins""" - def __init__(self, region): + def __init__(self, region, **kwargs): self.source_type = None self.source_name = None self.region = region self.site_data = None - @abc.abstractmethod - def set_config_opts(self, conf): - """Placeholder to set configuration options specific to each plugin. - - :param dict conf: Configuration options as dict - - Example: conf = { 'excel_spec': 'spec1.yaml', - 'excel_path': 'excel.xls' } - - Each plugin will have their own config opts. - """ - - return - - @abc.abstractmethod - def get_plugin_conf(self, kwargs): - """Validate and returns the plugin config parameters. - - If validation fails, Spyglass exits. - - :param char kwargs: Spyglass CLI parameters. - :returns plugin conf if successfully validated. - - Each plugin implements their own validation mechanism. - """ - - return {} - @abc.abstractmethod def get_racks(self, region): """Return list of racks in the region diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index 2346bdb..be75d49 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -57,7 +57,7 @@ def _get_intermediary_data(): @mock.patch('spyglass.parser.engine.ProcessDataSource', autospec=True) -@mock.patch('spyglass_plugin_xls.excel.ExcelPlugin', autospec=True) +@mock.patch('spyglass_plugin_xls.excel.ExcelPlugin', autospec=False) def test_intermediary_processor(mock_excel_plugin, mock_process_data_source): """Tests that the intermediary processor produces expected results""" plugin_name = 'excel'