mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Change fileclient from urllib2 to requests
This commit is contained in:
parent
255063ae15
commit
f809f91bf5
2 changed files with 5 additions and 3 deletions
|
@ -6,3 +6,4 @@ PyYAML
|
|||
pyzmq >= 2.2.0
|
||||
MarkupSafe
|
||||
apache-libcloud >= 0.14.0
|
||||
requests
|
||||
|
|
|
@ -10,6 +10,7 @@ import hashlib
|
|||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import requests
|
||||
|
||||
# Import third party libs
|
||||
import yaml
|
||||
|
@ -554,9 +555,9 @@ class Client(object):
|
|||
else:
|
||||
fixed_url = url
|
||||
try:
|
||||
with contextlib.closing(url_open(fixed_url)) as srcfp:
|
||||
with salt.utils.fopen(dest, 'wb') as destfp:
|
||||
shutil.copyfileobj(srcfp, destfp)
|
||||
req = requests.get(fixed_url)
|
||||
with salt.utils.fopen(dest, 'wb') as destfp:
|
||||
destfp.write(req.content)
|
||||
return dest
|
||||
except HTTPError as ex:
|
||||
raise MinionError('HTTP error {0} reading {1}: {3}'.format(
|
||||
|
|
Loading…
Add table
Reference in a new issue