Skip to content

Commit

Permalink
Support newer docker-py versions
Browse files Browse the repository at this point in the history
  • Loading branch information
avirshup committed Oct 4, 2016
1 parent 02de4ca commit aa1feb4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pyccc/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,14 @@ def _fetch(self):
See http://stackoverflow.com/questions/22683410/docker-python-client-api-copy
"""
import docker

self._open_tmpfile()
client = docker.Client(**self.dockerhost)
request = client.copy(self.containerid, self.containerpath)
args = (self.containerid, self.containerpath)
if hasattr(client, 'get_archive'): # handle different docker-py versions
request, meta = client.get_archive(*args)
else:
request = client.copy(*args)

# from stackoverflow link
filelike = StringIO.StringIO(request.read())
Expand Down

0 comments on commit aa1feb4

Please sign in to comment.