diff options
| author | Daniil Baturin <daniil@vyos.io> | 2021-12-16 22:42:22 +0700 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-16 22:42:22 +0700 | 
| commit | da5f36ce0971f41d9d45a16fc64abbe1150d92e5 (patch) | |
| tree | c362f76120458b1c0869469d46116ea29e9508fc /python | |
| parent | 95667607c9b3a1cc8beb8b908fbe538369e8c289 (diff) | |
| parent | 275f336f16925eaa53f870039a8cb71115cda132 (diff) | |
| download | vyos-1x-da5f36ce0971f41d9d45a16fc64abbe1150d92e5.tar.gz vyos-1x-da5f36ce0971f41d9d45a16fc64abbe1150d92e5.zip | |
Merge pull request #1109 from erkin/current
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: | 
