mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
implement lookup plugins for arbitrary enumeration over arbitrary things. See the mailing list for some cool examples.
This commit is contained in:
parent
29d49d415f
commit
c5d2f6b0d3
14 changed files with 135 additions and 28 deletions
|
@ -398,7 +398,10 @@ def template_from_file(basedir, path, vars):
|
|||
environment.filters['from_json'] = json.loads
|
||||
environment.filters['to_yaml'] = yaml.dump
|
||||
environment.filters['from_yaml'] = yaml.load
|
||||
data = codecs.open(realpath, encoding="utf8").read()
|
||||
try:
|
||||
data = codecs.open(realpath, encoding="utf8").read()
|
||||
except:
|
||||
raise errors.AnsibleError("unable to process as utf-8: %s" % realpath)
|
||||
t = environment.from_string(data)
|
||||
vars = vars.copy()
|
||||
try:
|
||||
|
@ -668,7 +671,8 @@ def filter_leading_non_json_lines(buf):
|
|||
|
||||
def import_plugins(directory):
|
||||
modules = {}
|
||||
for path in glob.glob(os.path.join(directory, '*.py')):
|
||||
python_files = os.path.join(directory, '*.py')
|
||||
for path in glob.glob(python_files):
|
||||
if path.startswith("_"):
|
||||
continue
|
||||
name, ext = os.path.splitext(os.path.basename(path))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue