Only expand '~' based on become_user/remote_user

Change brought forward from #00c023e in stable-2.5.

Closes #39281 (bug report)
Closes #39540 (PR with substantially the same change)
pull/39621/head
Abhijit Menon-Sen 7 years ago
parent f526a461ee
commit 0a119c391a

@ -567,7 +567,8 @@ class ActionBase(with_metaclass(ABCMeta, object)):
split_path = path.split(os.path.sep, 1)
expand_path = split_path[0]
if sudoable and expand_path == '~' and self._play_context.become and self._play_context.become_user:
if expand_path == '~':
if sudoable and self._play_context.become and self._play_context.become_user:
expand_path = '~%s' % self._play_context.become_user
else:
# use remote user instead, if none set default to current user

Loading…
Cancel
Save