File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515from kubernetes .client .rest import ApiException
1616
17- import select
1817import certifi
19- import time
2018import collections
21- from websocket import WebSocket , ABNF , enableTrace
22- import six
19+ import select
2320import ssl
21+ import time
22+
23+ import six
24+ import yaml
25+
2426from six .moves .urllib .parse import urlencode , quote_plus , urlparse , urlunparse
2527
28+ from websocket import WebSocket , ABNF , enableTrace
29+
2630STDIN_CHANNEL = 0
2731STDOUT_CHANNEL = 1
2832STDERR_CHANNEL = 2
@@ -203,6 +207,21 @@ def run_forever(self, timeout=None):
203207 else :
204208 while self .is_open ():
205209 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+
206225
207226 def close (self , ** kwargs ):
208227 """
You can’t perform that action at this time.
0 commit comments