Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Commit b16ba85

Browse files
committed
Fix archive fs parse comprehension
1 parent dc6c9b3 commit b16ba85

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

swift_upload_runner/download.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import tarfile
99
import time
1010
import asyncio
11+
import logging
1112

1213
import aiohttp.web
1314

@@ -19,6 +20,10 @@
1920
from .common import get_download_host
2021

2122

23+
LOGGER = logging.getLogger(__name__)
24+
LOGGER.setLevel(logging.DEBUG)
25+
26+
2227
# Unlike other classes, download uses python-requests for fetching objects
2328
# to simplify threading. Thus, timing out is not the default behavior.
2429

@@ -341,8 +346,10 @@ def _parse_archive_fs(
341346
# Create TarInfo for the directory
342347
if len(path) > 1:
343348
if path[0] in ret_fs.keys():
349+
LOGGER.debug(f"Skipping path {path} as added.")
344350
continue
345351

352+
LOGGER.debug(f"Adding directory for {path[0]} {path_prefix}")
346353
new_info = tarfile.TarInfo(
347354
name=get_path_from_list(
348355
[path[0] + "/"],
@@ -363,6 +370,8 @@ def _parse_archive_fs(
363370
):
364371
dir_contents.append(i)
365372

373+
LOGGER.debug(f"Dir {path[0]} contents: {dir_contents}")
374+
366375
ret_fs[path[0]] = {
367376
"name": get_path_from_list(
368377
[path[0]],
@@ -382,6 +391,7 @@ def _parse_archive_fs(
382391
# Path of == 1 implies a file
383392
else:
384393
# Create file TarInfo class
394+
LOGGER.debug(f"Adding file {path} to {path_prefix}")
385395
new_info = tarfile.TarInfo(name=get_path_from_list(
386396
path,
387397
path_prefix
@@ -412,9 +422,9 @@ def get_object_listing(
412422
"X-Auth-Token": self.auth.get_token()
413423
}
414424
) as req:
415-
self.fs = self._parse_archive_fs(
416-
i.split("/") for i in req.text.rstrip().lstrip().split("\n")
417-
)
425+
self.fs = self._parse_archive_fs([
426+
i.split("/") for i in req.text.lstrip().rstrip().split("\n")
427+
])
418428

419429
def sync_folders(
420430
self,

0 commit comments

Comments
 (0)