mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #30168 from abednarik/2015.8
Fix incorrect file permissions in file.line
This commit is contained in:
commit
e5d87a02b9
2 changed files with 4 additions and 2 deletions
|
@ -1459,9 +1459,9 @@ def line(path, content, match=None, mode=None, location=None,
|
|||
salt '*' file.line /etc/nsswitch.conf "networks:\tfiles dns", after="hosts:.*?", mode='ensure'
|
||||
'''
|
||||
path = os.path.realpath(os.path.expanduser(path))
|
||||
if not os.path.exists(path):
|
||||
if not os.path.isfile(path):
|
||||
if not quiet:
|
||||
raise CommandExecutionError('File "{0}" does not exists.'.format(path))
|
||||
raise CommandExecutionError('File "{0}" does not exists or is not a file.'.format(path))
|
||||
return False # No changes had happened
|
||||
|
||||
mode = mode and mode.lower() or mode
|
||||
|
|
|
@ -12,6 +12,7 @@ import sys
|
|||
import errno
|
||||
import time
|
||||
import random
|
||||
import shutil
|
||||
import salt.ext.six as six
|
||||
|
||||
|
||||
|
@ -117,6 +118,7 @@ class _AtomicWFile(object):
|
|||
if self._fh.closed:
|
||||
return
|
||||
self._fh.close()
|
||||
shutil.copymode(self._filename, self._tmp_filename)
|
||||
atomic_rename(self._tmp_filename, self._filename)
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
|
|
Loading…
Add table
Reference in a new issue