mirror of https://github.com/ansible/ansible.git
Fix fileglob plugin with non-existent subdirectory (#69451)
Since Ansible 2.9.8, if the fileglob plugin is passed a path containing
a subdirectory of a non-existent directory, it will fail. For example:
lookup('fileglob', '/'): ok
lookup('fileglob', '/foo'): (non-existent): ok
lookup('fileglob', '/foo/bar'): (non-existent): FAIL
The exact error depends on Python 2 or 3, but here is the error on
Python 2:
AttributeError: 'NoneType' object has no attribute 'endswith'
And on Python 3:
TypeError: expected str, bytes or os.PathLike object, not NoneType
This change fixes the issue by skipping paths that are falsey before
passing them to os.path.join().
Fixes: #69450
pull/69459/head
parent
01258580b9
commit
aa36b02ede
@ -0,0 +1,4 @@
|
||||
bugfixes:
|
||||
- Fix an issue with the ``fileglob`` plugin where passing a subdirectory of
|
||||
non-existent directory would cause it to fail -
|
||||
https://github.com/ansible/ansible/issues/69450
|
||||
@ -0,0 +1,6 @@
|
||||
- hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: fileglob should be empty
|
||||
assert:
|
||||
that: q("fileglob", seed) | length == 0
|
||||
Loading…
Reference in New Issue