mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #28047 from cachedout/issue_27534
Restore FTP functionality to file client
This commit is contained in:
commit
d1fa036b55
1 changed files with 10 additions and 0 deletions
|
@ -10,6 +10,7 @@ import logging
|
|||
import hashlib
|
||||
import os
|
||||
import shutil
|
||||
import ftplib
|
||||
|
||||
# Import salt libs
|
||||
from salt.exceptions import (
|
||||
|
@ -569,6 +570,15 @@ class Client(object):
|
|||
return dest
|
||||
except Exception:
|
||||
raise MinionError('Could not fetch from {0}'.format(url))
|
||||
if url_data.scheme == 'ftp':
|
||||
try:
|
||||
ftp = ftplib.FTP(url_data.hostname)
|
||||
ftp.login()
|
||||
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))
|
||||
|
||||
if url_data.scheme == 'swift':
|
||||
try:
|
||||
|
|
Loading…
Add table
Reference in a new issue