Make file.recurse work with gitfs_mountpoint

When a file.recurse state is specified for salt://foo, and there is a
gitfs_remote mounted at salt://foo/bar, when the fileserver is queried
for the list of directories on the master, 'foo' will not be among them,
causing a pre-flight check to fail and keeping the state from running.
This commit modifies that pre-flight check to also look for paths that
start with 'foo/' as well, allowing salt://foo to be properly matched
when a mountpoint is used.
This commit is contained in:
Erik Johnson 2014-02-15 00:32:04 -06:00
parent b24af2c8b3
commit e24554e188

View File

@ -1645,7 +1645,10 @@ def recurse(name,
# Check source path relative to fileserver root, make sure it is a
# directory
source_rel = source.partition('://')[2]
if source_rel not in __salt__['cp.list_master_dirs'](__env__):
master_dirs = __salt__['cp.list_master_dirs'](__env__)
if source_rel not in master_dirs \
and not any((x for x in master_dirs
if x.startswith(source_rel + '/'))):
ret['result'] = False
ret['comment'] = (
'The directory {0!r} does not exist on the salt fileserver'