From da175d0a5722f3b54a9086b38325994f20307a3f Mon Sep 17 00:00:00 2001 From: jpic Date: Tue, 5 Apr 2016 11:58:35 +0200 Subject: [PATCH] Bugfix: proper plugin configuration was reset Before this patch, if config was ['/some/path'] then it would enter the else block and config would be set to []. The regression this patch fixes was introduced by 700db154. --- lib/ansible/plugins/__init__.py | 2 +- test/units/plugins/test_plugins.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/__init__.py b/lib/ansible/plugins/__init__.py index c10d19cd38..03558df986 100644 --- a/lib/ansible/plugins/__init__.py +++ b/lib/ansible/plugins/__init__.py @@ -66,7 +66,7 @@ class PluginLoader: if config and not isinstance(config, list): config = [config] - else: + elif not config: config = [] self.config = config diff --git a/test/units/plugins/test_plugins.py b/test/units/plugins/test_plugins.py index 76a2600f53..3543cbc230 100644 --- a/test/units/plugins/test_plugins.py +++ b/test/units/plugins/test_plugins.py @@ -75,3 +75,7 @@ class TestErrors(unittest.TestCase): #with patch('glob.glob', mock_glob): # pass + def test_plugin__config(self): + config = ['/one', '/two'] + pl = PluginLoader('test', '', config, 'test_plugin') + self.assertEqual(pl.config, config)