Skip to content

Commit

Permalink
#7 Fixe the problem with archive extension
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsimb committed May 16, 2024
1 parent ddcee78 commit be02924
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

logger = logging.getLogger(__name__)

ARCHIVE_EXTENSIONS = [".tar.gz", ".tgz", ".zip", ".tar"]


def get_websocket_sslopt(use_ssl_cert_validation: bool = True,
ssl_trusted_ca: Optional[str] = None,
Expand Down Expand Up @@ -72,10 +74,17 @@ def get_language_settings(pyexasol_conn: pyexasol.ExaConnection, alter_type: Lan
def get_udf_path(bucket_base_path: bfs.path.PathLike, bucket_file: str) -> PurePosixPath:
"""
Returns the path of the specified file in a bucket, as it's seen from a UDF
For known types of archives removes the archive extension from the file name.
bucket_base_path - Base directory in the bucket
bucket_file - File path in the bucket, relative to the base directory.
"""

for extension in ARCHIVE_EXTENSIONS:
if bucket_file.endswith(extension):
bucket_file = bucket_file[: -len(extension)]
break

file_path = bucket_base_path / bucket_file
return PurePosixPath(file_path.as_udf_path())

Expand Down
2 changes: 0 additions & 2 deletions test/integration/test_placeholder.py

This file was deleted.

2 changes: 1 addition & 1 deletion test/unit/deployment/test_language_container_deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@pytest.fixture(scope='module')
def container_file_name() -> str:
return 'container_xyz.tag.gz'
return 'container_xyz.tar.gz'


@pytest.fixture(scope='module')
Expand Down

0 comments on commit be02924

Please sign in to comment.