mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 11:10:21 -07:00
Fix fileglob filter to work just like fileglob lookup plugin (#17480)
The fileglob lookup plugin only returns files, not directories. This is to be expected, as a mixed list would not be very useful in with_fileglob. However the fileglob filter does return anything glob.glob() returns. This change fixes this, so that fileglob returns files (as the name indicates). PS We could also offer a glob filter for thos that would need it ? This relates to comments in issue #17136 and fixes confusion in #17269.
This commit is contained in:
parent
d52a9cee46
commit
2daf527e63
1 changed files with 2 additions and 2 deletions
|
@ -126,8 +126,8 @@ def quote(a):
|
||||||
return pipes.quote(a)
|
return pipes.quote(a)
|
||||||
|
|
||||||
def fileglob(pathname):
|
def fileglob(pathname):
|
||||||
''' return list of matched files for glob '''
|
''' return list of matched regular files for glob '''
|
||||||
return glob.glob(pathname)
|
return [ g for g in glob.glob(pathname) if os.path.isfile(g) ]
|
||||||
|
|
||||||
def regex_replace(value='', pattern='', replacement='', ignorecase=False):
|
def regex_replace(value='', pattern='', replacement='', ignorecase=False):
|
||||||
''' Perform a `re.sub` returning a string '''
|
''' Perform a `re.sub` returning a string '''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue