Fix -M/--module-path option for ansible-doc and ansible-console (#31744)
Fixes #31743
This commit is contained in:
parent
2d2656049a
commit
9bc60cd05e
2 changed files with 8 additions and 6 deletions
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue