mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
expanduser on each component of plug-in paths
ansible.constants was calling expanduser (by way of shell_expand_path) on the entire configured value for the library and *_plugins configuration values, but these values have always been interpreted as multiple directories separated by os.pathsep. Thus, if you supplied multiple directories for one of these values, typically only the first (at least on *nix) would have e.g. "~" expanded to HOME. Now PluginLoader does expansion on each individual path in each of these variables.
This commit is contained in:
parent
c7c5ac1ab6
commit
b32131c867
3 changed files with 56 additions and 7 deletions
|
@ -16,6 +16,7 @@
|
|||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import glob
|
||||
import imp
|
||||
|
@ -108,6 +109,7 @@ class PluginLoader(object):
|
|||
# look in any configured plugin paths, allow one level deep for subcategories
|
||||
configured_paths = self.config.split(os.pathsep)
|
||||
for path in configured_paths:
|
||||
path = os.path.expanduser(path)
|
||||
contents = glob.glob("%s/*" % path)
|
||||
for c in contents:
|
||||
if os.path.isdir(c):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue