Skip to content

Commit

Permalink
Merge pull request #49843 from MTecknology/fix-49748
Browse files Browse the repository at this point in the history
Don't return False when target exists (file.rename)
  • Loading branch information
Erik Johnson authored Oct 2, 2018
2 parents 2d95187 + 92645cf commit e828e2f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion salt/states/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -6379,7 +6379,6 @@ def rename(name, source, force=False, makedirs=False):
if not force:
ret['comment'] = ('The target file "{0}" exists and will not be '
'overwritten'.format(name))
ret['result'] = False
return ret
elif not __opts__['test']:
# Remove the destination to prevent problems later
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/states/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ def test_rename(self):
with patch.object(os.path, 'lexists', mock_lex):
comt = ('The target file "{0}" exists and will not be '
'overwritten'.format(name))
ret.update({'comment': comt, 'result': False})
ret.update({'comment': comt, 'result': True})
self.assertDictEqual(filestate.rename(name, source), ret)

mock_lex = MagicMock(side_effect=[True, True, True])
Expand Down

0 comments on commit e828e2f

Please sign in to comment.