This repository was archived by the owner on Mar 13, 2022. It is now read-only.
File tree 1 file changed +23
-4
lines changed
1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change 14
14
15
15
from kubernetes .client .rest import ApiException
16
16
17
- import select
18
17
import certifi
19
- import time
20
18
import collections
21
- from websocket import WebSocket , ABNF , enableTrace
22
- import six
19
+ import select
23
20
import ssl
21
+ import time
22
+
23
+ import six
24
+ import yaml
25
+
24
26
from six .moves .urllib .parse import urlencode , quote_plus , urlparse , urlunparse
25
27
28
+ from websocket import WebSocket , ABNF , enableTrace
29
+
26
30
STDIN_CHANNEL = 0
27
31
STDOUT_CHANNEL = 1
28
32
STDERR_CHANNEL = 2
@@ -203,6 +207,21 @@ def run_forever(self, timeout=None):
203
207
else :
204
208
while self .is_open ():
205
209
self .update (timeout = None )
210
+ @property
211
+ def returncode (self ):
212
+ """
213
+ The return code, A None value indicates that the process hasn't
214
+ terminated yet.
215
+ """
216
+ if self .is_open ():
217
+ return None
218
+ else :
219
+ err = self .read_channel (ERROR_CHANNEL )
220
+ err = yaml .safe_load (err )
221
+ if err ['status' ] == "Success" :
222
+ return 0
223
+ return int (err ['details' ]['causes' ][0 ]['message' ])
224
+
206
225
207
226
def close (self , ** kwargs ):
208
227
"""
You can’t perform that action at this time.
0 commit comments