diff --git a/salt/states/file.py b/salt/states/file.py index db2dd8c673fb..3e13fab34f99 100644 --- a/salt/states/file.py +++ b/salt/states/file.py @@ -6375,7 +6375,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 diff --git a/tests/unit/states/test_file.py b/tests/unit/states/test_file.py index 8929ba4d4004..ca6f8d7b4a0a 100644 --- a/tests/unit/states/test_file.py +++ b/tests/unit/states/test_file.py @@ -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])