1
1
import json
2
2
from typing import Any , Dict , List , Optional
3
- from gefyra .utils import BridgeException , exec_command_pod
3
+ from gefyra .bridge .exceptions import BridgeInstallException
4
+ from gefyra .utils import exec_command_pod
4
5
import kubernetes as k8s
5
6
6
7
from gefyra .bridge .abstract import AbstractGefyraBridgeProvider
@@ -33,12 +34,7 @@ def __init__(
33
34
34
35
def install (self , parameters : Optional [Dict [Any , Any ]] = None ):
35
36
parameters = parameters or {}
36
- try :
37
- self ._patch_pod_with_carrier (
38
- handle_probes = parameters .get ("handleProbes" , True )
39
- )
40
- except BridgeException as be :
41
- raise BridgeException from be
37
+ self ._patch_pod_with_carrier (handle_probes = parameters .get ("handleProbes" , True ))
42
38
43
39
def _ensure_probes (self , container : k8s .client .V1Container ) -> bool :
44
40
probes = self ._get_all_probes (container )
@@ -144,11 +140,9 @@ def _patch_pod_with_carrier(
144
140
self ._get_all_probes (container ),
145
141
)
146
142
):
147
- self .logger .error (
148
- "Not all of the probes to be handled are currently"
149
- " supported by Gefyra"
143
+ raise BridgeInstallException (
144
+ message = "Not all of the probes to be handled are currently supported by Gefyra"
150
145
)
151
- raise BridgeException ()
152
146
if (
153
147
container .image
154
148
== f"{ self .configuration .CARRIER_IMAGE } :{ self .configuration .CARRIER_IMAGE_TAG } "
@@ -162,8 +156,8 @@ def _patch_pod_with_carrier(
162
156
container .image = f"{ self .configuration .CARRIER_IMAGE } :{ self .configuration .CARRIER_IMAGE_TAG } "
163
157
break
164
158
else :
165
- raise RuntimeError (
166
- f"Could not found container { self .container } in Pod { self .pod } "
159
+ raise BridgeInstallException (
160
+ message = f"Could not found container { self .container } in Pod { self .pod } "
167
161
)
168
162
self .logger .info (
169
163
f"Now patching Pod { self .pod } ; container { self .container } with Carrier"
0 commit comments