mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Context manager
This commit is contained in:
parent
4d6f6bb371
commit
6ea37ddbca
1 changed files with 2 additions and 1 deletions
|
@ -574,7 +574,8 @@ class Client(object):
|
|||
try:
|
||||
ftp = ftplib.FTP(url_data.hostname)
|
||||
ftp.login()
|
||||
ftp.retrbinary('RETR {0}'.format(url_data.path), salt.utils.fopen(dest, 'wb').write)
|
||||
with salt.utils.fopen(dest, 'wb') as fp_:
|
||||
ftp.retrbinary('RETR {0}'.format(url_data.path), fp_.write)
|
||||
return dest
|
||||
except Exception as exc:
|
||||
raise MinionError('Could not retrieve {0} from FTP server. Exception: {1}'.format(url, exc))
|
||||
|
|
Loading…
Add table
Reference in a new issue