Merge pull request #1482 from lleontop/fix_lambda_backend

Change lambda backend to support docker-py dependency changes
This commit is contained in:
Steve Pulec 2018-03-06 17:33:36 -05:00 committed by GitHub
commit 2a4f306bef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,7 @@ class _DockerDataVolumeContext:
# It doesn't exist so we need to create it
self._vol_ref.volume = self._lambda_func.docker_client.volumes.create(self._lambda_func.code_sha_256)
container = self._lambda_func.docker_client.containers.run('alpine', 'sleep 100', volumes={self.name: '/tmp/data'}, detach=True)
container = self._lambda_func.docker_client.containers.run('alpine', 'sleep 100', volumes={self.name: {'bind': '/tmp/data', 'mode': 'rw'}}, detach=True)
try:
tar_bytes = zip2tar(self._lambda_func.code_bytes)
container.put_archive('/tmp/data', tar_bytes)
@ -309,7 +309,7 @@ class LambdaFunction(BaseModel):
finally:
if container:
try:
exit_code = container.wait(timeout=300)
exit_code = container.wait(timeout=300)['StatusCode']
except requests.exceptions.ReadTimeout:
exit_code = -1
container.stop()