mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
addressed feedback
This commit is contained in:
parent
1abe05207c
commit
7c43417d46
2 changed files with 3 additions and 6 deletions
|
@ -13,7 +13,7 @@ import string
|
|||
import shutil
|
||||
import ftplib
|
||||
from tornado.httputil import parse_response_start_line, HTTPHeaders, HTTPInputError
|
||||
import uuid
|
||||
import salt.utils.atomicfile
|
||||
|
||||
# Import salt libs
|
||||
from salt.exceptions import (
|
||||
|
@ -1163,7 +1163,6 @@ class RemoteClient(Client):
|
|||
load['gzip'] = gzip
|
||||
|
||||
fn_ = None
|
||||
dest_tmp = None
|
||||
if dest:
|
||||
destdir = os.path.dirname(dest)
|
||||
if not os.path.isdir(destdir):
|
||||
|
@ -1223,12 +1222,11 @@ class RemoteClient(Client):
|
|||
saltenv,
|
||||
cachedir=cachedir) as cache_dest:
|
||||
dest = cache_dest
|
||||
dest_tmp = "{0}/{1}".format(os.path.dirname(dest), str(uuid.uuid4()))
|
||||
# If a directory was formerly cached at this path, then
|
||||
# remove it to avoid a traceback trying to write the file
|
||||
if os.path.isdir(dest):
|
||||
salt.utils.files.rm_rf(dest)
|
||||
fn_ = salt.utils.files.fopen(dest_tmp, 'wb+')
|
||||
fn_ = salt.utils.atomicfile.atomic_open(dest, 'wb+')
|
||||
if data.get('gzip', None):
|
||||
data = salt.utils.gzip_util.uncompress(data['data'])
|
||||
else:
|
||||
|
@ -1259,8 +1257,6 @@ class RemoteClient(Client):
|
|||
|
||||
if fn_:
|
||||
fn_.close()
|
||||
if dest_tmp:
|
||||
os.rename(dest_tmp, dest)
|
||||
log.info(
|
||||
'Fetching file from saltenv \'%s\', ** done ** \'%s\'',
|
||||
saltenv, path
|
||||
|
|
|
@ -464,6 +464,7 @@ def gen_min(cachedir, extra_mods='', overwrite=False, so_mods='',
|
|||
'salt/__init__.py',
|
||||
'salt/utils',
|
||||
'salt/utils/__init__.py',
|
||||
'salt/utils/atomicfile.py',
|
||||
'salt/utils/validate',
|
||||
'salt/utils/validate/__init__.py',
|
||||
'salt/utils/validate/path.py',
|
||||
|
|
Loading…
Add table
Reference in a new issue