Commit Graph

227 Commits

Author SHA1 Message Date
Felipe Bessa Coelho 3198dd9fde Sanitize create_container input
Client.create_container takes a volumes_from argument that should be: a
string, a list of strings, or None. If an empty list or dict is passed
instead, the docker daemon returns a 406 Client Error: Not Acceptable
2014-04-09 03:48:06 -03:00
Evgeniy L 18d4db09ec Moved APIError exception to docker.errors module. 2014-04-07 13:31:13 +04:00
Evgeniy L 231042a520 Create scope for docker client specific errors
With more granular and specific exceptions user
will be able to handle errors properly.

Also changed raising of Exception to more specific
TypeError which python raises in case of wrong
arguments.
2014-04-06 12:02:13 +04:00
shin- ad75b37a46 Merge branch 'volumes-from-as-list' of github.com:blackrobot/docker-py into blackrobot-volumes-from-as-list 2014-04-04 16:59:57 +02:00
shin- 54c904f806 Updated unit tests API version, flake8 fixes 2014-04-04 16:55:01 +02:00
Joseph Schorr 9ae3bcd2f3 Make sure the build command in the client sends the auth credentials along. Required for "FROM " lines that pull from private registries 2014-04-04 16:47:23 +02:00
shin- 6d78986cc3 Fixed multiplexed_socket_stream_helper 2014-04-04 16:02:20 +02:00
shin- 93bb0c5b10 Merge branch 'PY3_fixes' of github.com:macobo/docker-py into macobo-PY3_fixes 2014-04-04 15:56:21 +02:00
Damon Jablons ced3d5d71a Ensure that volumes_from exists 2014-04-01 16:08:06 -04:00
Damon Jablons d3d594d0b6 Allow volumes_from to be an iterable 2014-04-01 15:20:13 -04:00
Matt Way 66e6c9d4ef don't yield blank lines 2014-03-30 16:04:52 -04:00
Evgeniy L 2a1484f655 Fixes for flake8
Next rules were broken
* E265 block comment should start with '# '
* E713 test for membership should be 'not in'
2014-03-28 23:08:22 +04:00
Luka Stojanovic 030516eb29 parse_repository_tag function and accompanying test 2014-03-24 16:10:31 +01:00
Darren Shepherd e8b993ab8a Use requests to read chunk data instead of parsing the raw stream
The previous code had a bug in which it assumed that the chunk data had
no newlines in it.  In 0.9.0 newlines were added to the stream results,
which exposed this bug.
2014-03-19 08:43:13 -07:00
Darren Shepherd d0985b02be Ensure that stream=True is passed to requests when version >= 1.8 2014-03-19 08:41:59 -07:00
Daniel Graña b1f1e363a4 remove reference to uninitialized variable and extra parameter in function call 2014-03-18 11:00:16 -03:00
Daniel Graña 159a42ad5f Fix API version comparison 2014-03-18 11:00:16 -03:00
Karl-Aksel Puulmann b4605fc728 Styling as per comment, decode to utf-8, join rather concat strings 2014-03-11 22:46:45 +02:00
Karl-Aksel Puulmann af84a2de72 Python 3 fixes 2014-03-11 19:24:49 +02:00
Jens Deppe f0b08d8adf Support 'Domainname' in container creation 2014-03-10 07:47:19 -07:00
Maxime Petazzoni 655b5a304a Merge pull request #168 from joshuaconner/add_version_title_flag
add __title__ and __version__ variables to module
2014-02-24 18:08:52 -08:00
Joshua Conner 8d9b6828f0 add __title__ and __version__ variables to module 2014-02-24 18:01:19 -08:00
Maxime Petazzoni a102b189c6 Fix events() streaming by using _stream_helper()
Signed-off-by: Maxime Petazzoni <max@signalfuse.com>
2014-02-21 09:26:07 -08:00
Maxime Petazzoni 45cde4a034 Fix build() streaming and stream methods cleanup
Signed-off-by: Maxime Petazzoni <max@signalfuse.com>
2014-02-21 09:26:07 -08:00
Chris St. Pierre cfbd41ca56 Fix APIError for requests 1.1
requests 1.1, which is what's available on CentOS 6, doesn't support
passing the response code as a keyword argument.  It can be set after
the fact on both requests 1.1 and 1.2.

Docker-DCO-1.1-Signed-off-by: Chris St. Pierre <chris.a.st.pierre@gmail.com> (github: stpierre)
2014-02-10 09:52:51 -05:00
Maxime Petazzoni 64f4ba90ff Support remote API v1.8 (and make it the default)
Signed-off-by: Maxime Petazzoni <max@signalfuse.com>
2014-02-05 15:25:49 -08:00
Anthony Baire f7cef8a3e2 Fixed malformatted request when using empty list in create_container()
create_container() sends a malformatted request when volumes==[] or
ports==[], causing error 500 "create: ExportEnv json: cannot unmarshal
array into Go value of type map"

The empty lists must be converted into a dict (or removed)
2014-02-04 11:35:06 +01:00
Joffrey F 548b1e7f6c Merge pull request #156 from dmiyakawa/master
Allow copy() to accept dictionary like diff()
2014-01-31 09:40:23 -08:00
Joffrey F 789c22b933 Merge pull request #155 from bfirsh/fix-concat-string-with-bytes
Fix _stream_result concatenating bytes with str
2014-01-31 09:39:37 -08:00
Nicolas Delaby 51ead88e2d A ping should be successful if status_code is less than 400 2014-01-31 16:12:01 +01:00
Nicolas Delaby 0903ea3dd8 replace status with status_code as defined by requests API
Move this statement in `else` clause to make sure the try except block doesn't catch
coding errors.
2014-01-31 16:10:10 +01:00
Daisuke Miyakawa 334ac12661 Allow copy() to accept dictionary like diff()
Client.diff() silently convert container as a dictionary
to container['Id'] while Client.copy() does not.

This change makes copy() do the same job.
2014-01-31 12:42:57 +09:00
Ben Firshman b97e6ea043 Fix _stream_result concatenating bytes with str
Without this option, requests returns lines as bytes on Python 3
which can't be concatenated with the str '\n' in the yield.
2014-01-28 15:01:39 +00:00
Joffrey F 38f3d08114 Merge pull request #151 from ibuildthecloud/http-unix-scheme
Support requests >=2.1.0
2014-01-27 09:49:20 -08:00
Joffrey F 38a5967bfd Merge pull request #145 from aanand/set-stdinonce
If attaching to stdin, set StdinOnce, as per the docker CLI.
2014-01-27 09:43:28 -08:00
Ben Firshman 22f147569b Allow links to specified as (name, alias) tuples 2014-01-27 15:21:44 +00:00
Darren Shepherd 89922efbac Support requests >=2.1.0
Starting with requests 2.1.0 non-HTTP scheme URLs are not parsed anymore.
The net effect of this is that when using the unix socket in docker-py no
query string params are passed in the URL.  This change makes docker-py
internally use the scheme http+unix to indicate to requests that this is
still a HTTP URL and should be parsed.

Users of docker-py can still specify 'unix:' as the base_url.  The
following forms of base_url are accepted.

  http+unix://var/run/docker.sock
  unix://var/run/docker.sock
  unix:///var/run/docker.sock
  http://hostname
  tcp://hostname
2014-01-26 16:28:47 -07:00
Aanand Prasad f2285cb899 If attaching to stdin, set StdinOnce, as per the docker CLI. 2014-01-20 18:00:40 +00:00
Ben Firshman 4bc5d27e51 Add working_dir option to create_container 2014-01-19 16:41:40 +00:00
Ben Firshman ab2f7a5e38 Add cpu_shares option to create_container 2014-01-19 16:41:25 +00:00
Ben Firshman 8e8b355acd Add entrypoint option to create_container 2014-01-19 16:41:08 +00:00
shin- 477831334c Merge branch 'master' of git://github.com/dotcloud/docker-py 2014-01-16 20:26:06 +01:00
shin- 33f5ac57d8 Removed data argument in import_image (unused?) 2014-01-16 20:25:26 +01:00
shin- 8a5cd6ae65 Merge branch 'feature/image-import' of github.com:tarnfeld/docker-py into tarnfeld-feature/image-import 2014-01-16 20:22:33 +01:00
Joffrey F 4bf75ded43 Merge pull request #119 from ureyes84/master
Updated port function
2014-01-16 11:19:34 -08:00
Maxime Petazzoni dad95ba679 Default to /tcp for port definitions in create_container()
Fixes #141.

Signed-off-by: Maxime Petazzoni <max@signalfuse.com>
2014-01-16 10:23:02 -08:00
Maxime Petazzoni 77edd8b601 Merge pull request #138 from aanand/container-output-without-logs
container_output() method for streaming the output without logs=1
2014-01-16 09:05:46 -08:00
Aanand Prasad cea085f046 Use relative imports 2014-01-16 13:28:00 +00:00
Aanand Prasad 3cb6482f8a attach() method now parses multiplexing frames
The previous version of `attach` didn't look like it was doing
anything useful, as it just yielded 4096-byte chunks of raw /attach
output, without doing any frame parsing.

Now `attach` is identical to `logs`, except that by default it
doesn't show historical output. `logs` is now a wrapper around
`attach` which sets `logs=True`, and its behaviour is unchanged.
2014-01-16 10:56:17 +00:00
Maxime Petazzoni d73901a7ed Merge pull request #140 from aanand/sensible-url-handling
Sensible url handling
2014-01-14 10:13:09 -08:00