diff options
author | erkin <e.altunbas@vyos.io> | 2021-12-16 18:15:05 +0300 |
---|---|---|
committer | erkin <e.altunbas@vyos.io> | 2021-12-16 18:15:05 +0300 |
commit | 275f336f16925eaa53f870039a8cb71115cda132 (patch) | |
tree | c362f76120458b1c0869469d46116ea29e9508fc /python | |
parent | 9737a55f6dde490e7fdf1c9d5c5733e48c94d141 (diff) | |
download | vyos-1x-275f336f16925eaa53f870039a8cb71115cda132.tar.gz vyos-1x-275f336f16925eaa53f870039a8cb71115cda132.zip |
remote: T3356: Remove incomplete HTTP upload progressbar support
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/remote.py | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/python/vyos/remote.py b/python/vyos/remote.py index 694ea62ab..aa62ac60d 100644 --- a/python/vyos/remote.py +++ b/python/vyos/remote.py @@ -74,21 +74,6 @@ class SourceAdapter(HTTPAdapter): num_pools=connections, maxsize=maxsize, block=block, source_address=self._source_pair) -class WrappedFile: - def __init__(self, obj, size=None, chunk_size=CHUNK_SIZE): - self._obj = obj - self._progress = size and make_incremental_progressbar(chunk_size / size) - def read(self, size=-1): - if self._progress: - next(self._progress) - self._obj.read(size) - def write(self, size=-1): - if self._progress: - next(self._progress) - self._obj.write(size) - def __getattr__(self, attr): - return getattr(self._obj, attr) - def check_storage(path, size): """ @@ -264,10 +249,9 @@ class HttpC: shutil.copyfileobj(r.raw, f) def upload(self, location: str): - size = os.path.getsize(location) if self.progressbar else None - # Keep in mind that `data` can be a file-like or iterable object. - with self._establish() as s, file(location, 'rb') as f: - s.post(self.urlstring, data=WrappedFile(f, size), allow_redirects=True) + # Does not yet support progressbars. + with self._establish() as s, open(location, 'rb') as f: + s.post(self.urlstring, data=f, allow_redirects=True) class TftpC: |