@@ -229,6 +229,7 @@ def connect_to_pro_server(
229
229
api_key : Optional [str ] = None ,
230
230
refresh : bool = False ,
231
231
pro_api_url : Optional [str ] = None ,
232
+ verify_ssl : Union [str , bool ] = True ,
232
233
) -> None :
233
234
"""Connect the client to a ZenML Pro server.
234
235
@@ -238,6 +239,8 @@ def connect_to_pro_server(
238
239
api_key: The API key to use to authenticate with the ZenML Pro server.
239
240
refresh: Whether to force a new login flow with the ZenML Pro server.
240
241
pro_api_url: The URL for the ZenML Pro API.
242
+ verify_ssl: Whether to verify the server's TLS certificate. If a string
243
+ is passed, it is interpreted as the path to a CA bundle file.
241
244
242
245
Raises:
243
246
ValueError: If incorrect parameters are provided.
@@ -280,7 +283,12 @@ def connect_to_pro_server(
280
283
# server to connect to.
281
284
if api_key :
282
285
if server_url :
283
- connect_to_server (server_url , api_key = api_key , pro_server = True )
286
+ connect_to_server (
287
+ server_url ,
288
+ api_key = api_key ,
289
+ pro_server = True ,
290
+ verify_ssl = verify_ssl ,
291
+ )
284
292
return
285
293
else :
286
294
raise ValueError (
@@ -299,6 +307,7 @@ def connect_to_pro_server(
299
307
try :
300
308
token = web_login (
301
309
pro_api_url = pro_api_url ,
310
+ verify_ssl = verify_ssl ,
302
311
)
303
312
except AuthorizationException as e :
304
313
cli_utils .error (f"Authorization error: { e } " )
@@ -418,7 +427,9 @@ def connect_to_pro_server(
418
427
f"Connecting to ZenML Pro server: { server .name } [{ str (server .id )} ] "
419
428
)
420
429
421
- connect_to_server (server .url , api_key = api_key , pro_server = True )
430
+ connect_to_server (
431
+ server .url , api_key = api_key , pro_server = True , verify_ssl = verify_ssl
432
+ )
422
433
423
434
# Update the stored server info with more accurate data taken from the
424
435
# ZenML Pro workspace object.
@@ -555,7 +566,7 @@ def _fail_if_authentication_environment_variables_set() -> None:
555
566
not return until the server exits or is stopped with CTRL+C
556
567
557
568
* `--docker`: start the local ZenML server as a Docker container instead
558
- of a local process
569
+ of a local background process.
559
570
560
571
* `--port`: use a custom TCP port value for the local ZenML server
561
572
@@ -775,6 +786,9 @@ def login(
775
786
pro_server = server ,
776
787
refresh = True ,
777
788
pro_api_url = pro_api_url ,
789
+ verify_ssl = ssl_ca_cert
790
+ if ssl_ca_cert is not None
791
+ else not no_verify_ssl ,
778
792
)
779
793
return
780
794
@@ -822,6 +836,7 @@ def login(
822
836
# Prefer the pro API URL extracted from the server info if
823
837
# available
824
838
pro_api_url = server_pro_api_url or pro_api_url ,
839
+ verify_ssl = verify_ssl ,
825
840
)
826
841
else :
827
842
connect_to_server (
@@ -837,6 +852,7 @@ def login(
837
852
api_key = api_key_value ,
838
853
refresh = refresh ,
839
854
pro_api_url = pro_api_url ,
855
+ verify_ssl = verify_ssl ,
840
856
)
841
857
842
858
elif current_non_local_server and not refresh :
@@ -861,6 +877,7 @@ def login(
861
877
# Prefer the pro API URL extracted from the server info if
862
878
# available
863
879
pro_api_url = server_pro_api_url or pro_api_url ,
880
+ verify_ssl = verify_ssl ,
864
881
)
865
882
else :
866
883
cli_utils .declare (
@@ -890,6 +907,7 @@ def login(
890
907
connect_to_pro_server (
891
908
api_key = api_key_value ,
892
909
pro_api_url = pro_api_url ,
910
+ verify_ssl = verify_ssl ,
893
911
)
894
912
895
913
0 commit comments