Commit 1a390558 authored by Aurélien Dunand's avatar Aurélien Dunand Committed by Seblu
Browse files

Copy file from http without read it in one time

When huge payload was read, it could cause Out Of Memory error.
Use istools copyfileobj for read chunk by chunk.

Signed-off-by: default avatarSeblu <sebastien.luttringer@smartjog.com>
parent a164cd39
Loading
Loading
Loading
Loading
+1 −1
Changes for installsystems/tools.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ def copy(source, destination, uid=None, gid=None, mode=None, timeout=None):
    elif (stype == "http" or stype == "ftp") and dtype == "file":
        f_dest = open(destination, "w")
        f_source = urllib2.urlopen(source, timeout=timeout)
        f_dest.write(f_source.read())
        copyfileobj(f_source, f_dest)
    elif stype == "file" and dtype == "":
        raise NotImplementedError
    else: