Backport #40500 for 2.5 - synchronize fixes (#40545)

* Group logic detecting user, ensure rsync_opts is a list if omitted. Fixes #40483

(cherry picked from commit ea176427b4)

* Add changelog for #40500
This commit is contained in:
Matt Martz 2018-05-23 21:04:18 -05:00 committed by Jordan Borean
parent 70a60b6166
commit fac5a14ded
3 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1,3 @@
bugfixes:
- synchronize - Ensure rsync_opts is a list when not provided
- action - Ensure remote user is correctly calculated when expanding the remote user path

View file

@ -372,7 +372,7 @@ def main():
group=dict(type='bool'),
set_remote_user=dict(type='bool', default=True),
rsync_timeout=dict(type='int', default=0),
rsync_opts=dict(type='list'),
rsync_opts=dict(type='list', default=[]),
ssh_args=dict(type='str'),
partial=dict(type='bool', default=False),
verify_host=dict(type='bool', default=False),

View file

@ -583,7 +583,7 @@ class ActionBase(with_metaclass(ABCMeta, object)):
expand_path = '~%s' % self._play_context.become_user
else:
# use remote user instead, if none set default to current user
expand_path = '~%s' % self._play_context.remote_user or self._connection.default_user or ''
expand_path = '~%s' % (self._play_context.remote_user or self._connection.default_user or '')
# use shell to construct appropriate command and execute
cmd = self._connection._shell.expand_user(expand_path)