Commit bdbbb001 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added forced upload id to package from tar command. [skip ci]

parent 30612af4
Pipeline #47998 skipped
......@@ -86,10 +86,11 @@ def index(drop, with_metadata, per_query):
@migration.command(help='Transfer migration index to elastic search')
@click.argument('tar-file', nargs=1)
@click.option('--offset', default=None, type=int, help='Start processing the tar from a specific offset, e.g. to continue')
def package_tar(tar_file, offset):
@click.option('--upload', default=None, type=str, help='Force the whole tar contents into a given upload id')
def package_tar(tar_file, offset, upload):
Package.create_packages_from_tar(tar_file, offset=offset, compress=True)
Package.create_packages_from_tar(tar_file, offset=offset, compress=True, forced_upload_id=upload)
@migration.command(help='Reset migration version to start a new migration.')
......@@ -291,7 +291,9 @@ class Package(Document):
return report
def create_packages_from_tar(cls, source_tar_path: str, offset: int = None, compress: bool = True) -> None:
def create_packages_from_tar(
cls, source_tar_path: str, offset: int = None, compress: bool = True,
forced_upload_id: str = None) -> None:
Utility function for manually creating packages within a tar archive.
Assuming that the tarfile contains multiple extracted uploads. The first directory
......@@ -368,7 +370,12 @@ class Package(Document):
next_info =
while next_info is not None:
if next_info.isfile():
segments ='/')
if forced_upload_id is not None:
name = os.path.join(forced_upload_id,
name =
segments = name.split('/')
upload = segments[0]
if upload != current_upload:
......@@ -451,7 +458,7 @@ class Package(Document):
current_directory = directory
current_package.add_file(next_info,[len(current_upload) + 1:])
current_package.add_file(next_info, name[len(current_upload) + 1:])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment