From a12432fba262e8f95470576c4a866107d899c1b9 Mon Sep 17 00:00:00 2001 From: shin- Date: Thu, 25 Jul 2013 18:27:44 +0200 Subject: [PATCH] Added 'quiet' param to Client.build --- README.md | 2 +- docker/client.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d4994276..fad1c14d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ API Client class. `base_url` refers to the protocol+hostname+port where the docker server is hosted. Version is the version of the API the client will use. -* `c.build(path=None, tag=None, fileobj=None)` +* `c.build(path=None, tag=None, quiet=False, fileobj=None)` Similar to the `docker build` command. Either `path` or `fileobj` needs to be set. `path` can be a local path (to a directory containing a Dockerfile) or a remote URL. `fileobj` must be a readable file-like object to a Dockerfile. diff --git a/docker/client.py b/docker/client.py index 9932533a..bb476ca5 100644 --- a/docker/client.py +++ b/docker/client.py @@ -126,7 +126,7 @@ class Client(requests.Session): else: break - def build(self, path=None, tag=None, fileobj=None): + def build(self, path=None, tag=None, quiet=False, fileobj=None): remote = context = headers = None if path is None and fileobj is None: raise Exception("Either path or fileobj needs to be provided.") @@ -140,12 +140,11 @@ class Client(requests.Session): context = self._tar(path) u = self._url('/build') - params = { 'tag': tag, 'remote': remote } + params = { 'tag': tag, 'remote': remote, 'q': quiet } if context is not None: headers = { 'Content-Type': 'application/tar' } - res = self._result(self.post(u, context, params=params, - headers=headers)) + headers=headers, stream=True)) srch = r'Successfully built ([0-9a-f]+)' match = re.search(srch, res) if not match: