Make sure dwim'd relative path ends in a "/" if the original does

Fixes #7296
This commit is contained in:
James Cammarata 2014-05-06 12:51:26 -05:00
parent 537494c2d6
commit 4d118d1c72

View file

@ -32,7 +32,12 @@ class ActionModule(object):
if 'vars' in self.inject: if 'vars' in self.inject:
if '_original_file' in self.inject['vars']: if '_original_file' in self.inject['vars']:
# roles # roles
original_path = path
path = utils.path_dwim_relative(self.inject['_original_file'], 'files', path, self.runner.basedir) path = utils.path_dwim_relative(self.inject['_original_file'], 'files', path, self.runner.basedir)
if original_path and original_path[-1] == '/' and path[-1] != '/':
# make sure the dwim'd path ends in a trailing "/"
# if the original path did
path += '/'
elif 'inventory_dir' in self.inject['vars']: elif 'inventory_dir' in self.inject['vars']:
# non-roles # non-roles
abs_dir = os.path.abspath(self.inject['vars']['inventory_dir']) abs_dir = os.path.abspath(self.inject['vars']['inventory_dir'])