Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
ac0a7d96
Commit
ac0a7d96
authored
Sep 30, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4306 from sivel/3563-glob
Add fileglob Jinja2 filter. Fixes #3563
parents
9b5fb9ad
535ce970
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
lib/ansible/runner/filter_plugins/core.py
+8
-0
test/TestFilters.py
+6
-0
No files found.
lib/ansible/runner/filter_plugins/core.py
View file @
ac0a7d96
...
...
@@ -21,6 +21,7 @@ import os.path
import
yaml
import
types
import
pipes
import
glob
from
ansible
import
errors
from
ansible.utils
import
md5s
...
...
@@ -74,6 +75,10 @@ def quote(a):
''' return its argument quoted for shell usage '''
return
pipes
.
quote
(
a
)
def
fileglob
(
pathname
):
''' return list of matched files for glob '''
return
glob
.
glob
(
pathname
)
class
FilterModule
(
object
):
''' Ansible core jinja2 filters '''
...
...
@@ -115,5 +120,8 @@ class FilterModule(object):
# md5 hex digest of string
'md5'
:
md5s
,
# file glob
'fileglob'
:
fileglob
,
}
test/TestFilters.py
View file @
ac0a7d96
...
...
@@ -2,6 +2,7 @@
Test bundled filters
'''
import
os.path
import
unittest
,
tempfile
,
shutil
from
ansible
import
playbook
,
inventory
,
callbacks
import
ansible.runner.filter_plugins.core
...
...
@@ -83,6 +84,11 @@ class TestFilters(unittest.TestCase):
a
=
ansible
.
runner
.
filter_plugins
.
core
.
quote
(
'ls | wc -l'
)
assert
a
==
"'ls | wc -l'"
def
test_fileglob
(
self
):
pathname
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'*'
)
a
=
ansible
.
runner
.
filter_plugins
.
core
.
fileglob
(
pathname
)
assert
__file__
in
a
#def test_filters(self):
# this test is pretty low level using a playbook, hence I am disabling it for now -- MPD.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment