mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Make windows file remove return like others
This commit is contained in:
parent
5770b05612
commit
bee29024f5
2 changed files with 7 additions and 11 deletions
|
@ -1066,13 +1066,14 @@ def remove(path, force=False):
|
|||
|
||||
path = os.path.expanduser(path)
|
||||
|
||||
|
||||
if not os.path.isabs(path):
|
||||
raise SaltInvocationError('File path must be absolute: {0}'.format(path))
|
||||
|
||||
# Does the file/folder exists
|
||||
if not os.path.exists(path):
|
||||
raise CommandExecutionError('Path not found: {0}'.format(path))
|
||||
|
||||
if not os.path.isabs(path):
|
||||
raise SaltInvocationError('File path must be absolute.')
|
||||
|
||||
# Remove ReadOnly Attribute
|
||||
if force:
|
||||
# Get current file attributes
|
||||
|
|
|
@ -179,14 +179,9 @@ class FileModuleTest(ModuleCase):
|
|||
|
||||
def test_cannot_remove(self):
|
||||
ret = self.run_function('file.remove', arg=['tty'])
|
||||
if salt.utils.platform.is_windows():
|
||||
self.assertEqual(
|
||||
'ERROR: Path not found: tty', ret
|
||||
)
|
||||
else:
|
||||
self.assertEqual(
|
||||
'ERROR executing \'file.remove\': File path must be absolute: tty', ret
|
||||
)
|
||||
self.assertEqual(
|
||||
'ERROR executing \'file.remove\': File path must be absolute: tty', ret
|
||||
)
|
||||
|
||||
def test_source_list_for_single_file_returns_unchanged(self):
|
||||
ret = self.run_function('file.source_list', ['salt://http/httpd.conf',
|
||||
|
|
Loading…
Add table
Reference in a new issue