Skip to content

Commit

Permalink
Support docker sdk for python 3.0.1
Browse files Browse the repository at this point in the history
Docker sdk python 3.0.x has changed typof return object in
`Container#exec_run`.
  • Loading branch information
hankei6km committed Feb 11, 2018
1 parent bf5177f commit a4679d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = xrosfs
version = 0.1.0
version = 0.1.1
url = https://github.com/hankei6km/xrosfs
author = hankei6km
author_email = hankei6km@gmail.com
Expand Down
10 changes: 9 additions & 1 deletion xrosfs/conshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,16 @@ def _get_shell_item(self):
return ret

def _open_stream(self):
self.sh_stream = self.stream_exec(
exec_result = self.stream_exec(
' '.join((self._shell_path, self._shell_args)))
# if hasattr(exec_result, 'output'):
# https://stackoverflow.com/questions/5008828/convert-a-python-type-object-to-a-string
if type(exec_result).__name__ is 'ExecResult':
# docker sdk for python 3.0.x return tuple of (exit_code, output).
# ExecResult#output works as return value of sdk2.x.
self.sh_stream = exec_result.output
else:
self.sh_stream = exec_result

def _switch_to_support_shell(self):
item = self._get_shell_item()
Expand Down

0 comments on commit a4679d7

Please sign in to comment.