2
2
from typing import Optional
3
3
from datetime import timedelta
4
4
import json
5
+ from pathlib import Path
5
6
6
7
import exasol .bucketfs as bfs
7
8
from exasol .python_extension_common .deployment .extract_validator import ExtractValidator
@@ -55,11 +56,12 @@ def _get_optional_bfs_port(conf: Secrets) -> int | None:
55
56
56
57
57
58
def deploy_language_container (conf : Secrets ,
58
- container_url : str ,
59
- container_name : str ,
60
59
path_in_bucket : str ,
61
60
language_alias : str ,
62
61
activation_key : str ,
62
+ container_url : str | None = None ,
63
+ container_file : Path | None = None ,
64
+ container_name : str | None = None ,
63
65
allow_override : bool = True ,
64
66
timeout : timedelta = timedelta (minutes = 10 )) -> None :
65
67
"""
@@ -73,16 +75,24 @@ def deploy_language_container(conf: Secrets,
73
75
conf:
74
76
The secret store. The store must contain the DB connection parameters
75
77
and the parameters of the BucketFS service.
76
- container_url:
77
- The url to download the language container from
78
- container_name:
79
- The language container will be saved in the BucketFS with this name.
80
78
path_in_bucket:
81
79
Path in the BucketFS where the container should be saved.
82
80
language_alias:
83
81
The language alias of the extension's language container.
84
82
activation_key:
85
83
A secret store key for saving the activation SQL.
84
+ container_url:
85
+ An optional URL to download the language container from.
86
+ Either the `container_url` or `container_file` must be provided,
87
+ otherwise a ValueError will be raised.
88
+ container_file:
89
+ An optional path of the container file (*.tar.gz) in a local file system.
90
+ Either the `container_url` or `container_file` must be provided,
91
+ otherwise a ValueError will be raised.
92
+ container_name:
93
+ If provided, the language container will be saved in given bucket of
94
+ BucketFS with this filename. Otherwise, the name of the container file
95
+ will be used.
86
96
allow_override:
87
97
If True allows overriding the language definition.
88
98
timeout:
@@ -101,11 +111,20 @@ def deploy_language_container(conf: Secrets,
101
111
extract_validator = validator
102
112
)
103
113
104
- deployer .download_and_run (container_url ,
105
- container_name ,
106
- alter_system = False ,
107
- allow_override = allow_override ,
108
- wait_for_completion = True )
114
+ if container_file :
115
+ deployer .run (container_file ,
116
+ container_name ,
117
+ alter_system = False ,
118
+ allow_override = allow_override ,
119
+ wait_for_completion = True )
120
+ elif container_url :
121
+ deployer .download_and_run (container_url ,
122
+ container_name ,
123
+ alter_system = False ,
124
+ allow_override = allow_override ,
125
+ wait_for_completion = True )
126
+ else :
127
+ raise ValueError ("Either container URL or container file must be provided" )
109
128
110
129
# Install the language container.
111
130
# Save the activation SQL in the secret store.
0 commit comments