mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 22:30:22 -07:00
Merge pull request #2978 from bryanlarsen/basename
add basename and dirname to the core jinja2 filters
This commit is contained in:
commit
4b988dbd43
1 changed files with 5 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
|
import os.path
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
def to_nice_yaml(*a, **kw):
|
def to_nice_yaml(*a, **kw):
|
||||||
|
@ -45,5 +46,9 @@ class FilterModule(object):
|
||||||
'to_yaml': yaml.safe_dump,
|
'to_yaml': yaml.safe_dump,
|
||||||
'to_nice_yaml': to_nice_yaml,
|
'to_nice_yaml': to_nice_yaml,
|
||||||
'from_yaml': yaml.safe_load,
|
'from_yaml': yaml.safe_load,
|
||||||
|
|
||||||
|
# path
|
||||||
|
'basename': os.path.basename,
|
||||||
|
'dirname': os.path.dirname,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue