From 9bc60cd05e011d982909befdd913a876d8c36034 Mon Sep 17 00:00:00 2001 From: Ilya Margolin Date: Mon, 16 Oct 2017 16:47:40 +0200 Subject: [PATCH] Fix -M/--module-path option for ansible-doc and ansible-console (#31744) Fixes #31743 --- lib/ansible/cli/console.py | 7 ++++--- lib/ansible/cli/doc.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/ansible/cli/console.py b/lib/ansible/cli/console.py index 9e9d93ee538..bec0c929520 100644 --- a/lib/ansible/cli/console.py +++ b/lib/ansible/cli/console.py @@ -126,9 +126,10 @@ class ConsoleCLI(CLI, cmd.Cmd): def list_modules(self): modules = set() - if self.options.module_path is not None: - for i in self.options.module_path.split(os.pathsep): - module_loader.add_directory(i) + if self.options.module_path: + for path in self.options.module_path: + if path: + module_loader.add_directory(path) module_paths = module_loader._get_paths() for path in module_paths: diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py index 747618da8fd..407904b74c8 100644 --- a/lib/ansible/cli/doc.py +++ b/lib/ansible/cli/doc.py @@ -103,9 +103,10 @@ class DocCLI(CLI): loader = module_loader # add to plugin path from command line - if self.options.module_path is not None: - for i in self.options.module_path.split(os.pathsep): - loader.add_directory(i) + if self.options.module_path: + for path in self.options.module_path: + if path: + loader.add_directory(path) # save only top level paths for errors search_paths = DocCLI.print_paths(loader)