Lars Kellogg-Stedman
444a2ad808
Do not erroneously mask exceptions
...
There was a catch-all `except` statement in `create_containers`:
try:
containers = do_create(count, params)
except:
self.pull_image()
containers = do_create(count, params)
This would mask a variety of errors that should be exposed, including
API compatability errors (as in #1707 ) and common Python exceptions (KeyError, ValueError, etc) that could result from errors in the code.
This change makes the `except` statement more specific, and only attempts to pull the image and start a container if the original create attempt failed due to a 404 error from the docker API.
2015-07-16 15:25:39 -04:00
Lars Kellogg-Stedman
6672205f49
docker: permit empty or false pid
...
The `docker` Python module only accepts `None` or `'host'` as arguments.
This makes it difficult to conditionally set the `pid` attribute using
standard Ansible syntax.
This change converts any value that evaluates as boolean `False` to
`None`, which includes empty strings:
pid:
As well as an explicit `false`:
pid: false
This permits the following to work as intended:
- hosts: localhost
tasks:
- name: starting container
docker:
docker_api_version: 1.18
image: larsks/mini-httpd
name: web
pid: "{{ container_pid|default('') }}"
If `container_pid` is set to `host` somewhere, this will create a
Docker container with `pid=host`; otherwise, this will create a
container with normal isolated pid namespace.
2015-07-15 21:15:49 -04:00
Brian Coca
51b6b725cc
Merge pull request #1078 from andrewgdavis/devel
...
ansible_facts reflects 1.8 output
2015-07-04 15:19:22 -04:00
Brian Coca
afeb3c8d07
Merge pull request #1031 from smashwilson/docker-wait
...
[docker] Wait for process exit on detached=no.
2015-06-30 00:24:02 -04:00
Brian Coca
5f5f01833f
Merge pull request #1508 from tarrychk/issue_1442
...
Fix computation of port bindings
2015-06-29 23:54:27 -04:00
Brian Coca
038cc05f4e
Merge pull request #1609 from smashwilson/default-net-bridge
...
[docker] Prevent unnecessary reloads due to the net parameter
2015-06-29 23:38:32 -04:00
Brian Coca
ec15b67712
Merge pull request #547 from steveeJ/devel
...
Fix bind-volumes on docker >= 1.4.0
2015-06-29 20:13:23 -04:00
Ash Wilson
29e4a127e1
Default net to 'bridge' in container diff
...
This prevents an unnecessary reload when the `net` parameter is unspecified
(i.e. almost always).
2015-06-25 17:11:38 -05:00
Toshio Kuratomi
964d731722
Add version_added documentation to log_driver parameter
2015-06-25 08:29:42 -07:00
Toshio Kuratomi
718f32a042
Merge pull request #1405 from ryanwalls/docker-module-log-driver
...
Add support for --log-driver option that docker released with Docker 1.6
2015-06-25 08:25:46 -07:00
Brian Coca
19f6099777
minor doc fixes
2015-06-17 12:39:14 -04:00
Robin Roth
64fe01178f
add comment: ports need to be exposed.
...
port mapping with this module only works for ports that are exposed either in the Dockerfile or via an additional arguments. This is different from the command line docker client, that is willing to also map ports that are not exposed.
This comments makes the behaviour more obvious.
2015-06-17 18:01:35 +02:00
Greg DeKoenigsberg
28a869a030
Updating cloud modules with proper github author information
2015-06-15 14:41:22 -04:00
Ed Hein
558f2ace1f
Fix computation of port bindings. Port bindings configuration can be a list
...
if several host ports are bound to the same guest port.
2015-06-12 12:36:52 +02:00
Ryan Walls
a2630d40fb
Fix typo in Docker module.
2015-06-02 00:09:01 -06:00
Ryan Walls
88eddb13c0
Update docker module to avoid false positives when containers are first created. Also have the module check
...
for api compatibility before trying to set a "--log-driver" option.
2015-06-01 09:48:24 -06:00
Ryan Walls
c95717afe5
Set default "log_driver" option to None in docker module.
2015-05-28 11:36:20 -06:00
Ryan Walls
5f1d88a829
Update docker module to look at log_driver variable when deciding if container configuration has changed.
2015-05-27 12:33:11 -06:00
Andrew Pashkin
27c174128b
Add 'docker_api_version' to docker_image
...
By default docker-py uses latest version of Docker API. This is not
always desireable, and this patch adds option to specify version, that
should be used.
2015-05-23 23:17:30 +03:00
Ryan Walls
3f679933a6
Add support for --log-driver option that docker released with Docker 1.6
2015-05-22 16:36:38 -06:00
Pierre Baillet
06e3ac7bf4
Support optional dockerfile name
2015-05-18 16:51:12 +02:00
Toshio Kuratomi
60a66a544d
Several cleanups to many modules:
...
* Fix docs to specify when python2.6+ is required (due to a library
dep). This helps us know when it is okay to use python2.6+ syntax in
the file.
* remove BabyJson returns. See #1211 This commit fixes all but the
openstack modules.
* Use if __name__ == '__main__' to only run the main part of the module
if the module is run as a program. This allows for the potential to
unittest the code later.
2015-05-11 12:15:53 -07:00
Ratnadeep Debnath
be66acb436
Fixed typo in cloud docker module.
2015-05-06 15:23:40 +05:30
Toshio Kuratomi
f444e49dfa
Fix error when container has no names.
...
Rename loop variable from "i" to more informative "container"
Fixes #1188
2015-05-04 10:16:01 -07:00
Pascal Borreli
f29a6ec54d
Fixed typos
2015-05-04 12:54:03 +01:00
Toshio Kuratomi
1fdf75d49d
Second try at fixing #1227 -- set e default value earlier
2015-04-30 19:09:22 -07:00
Toshio Kuratomi
e51ea29d8f
Return empty list if an image has no repo_tags
2015-04-30 17:44:05 -07:00
Toshio Kuratomi
e356692c74
Get docker's default api version definition from both 1.2 location and pre-1.2 location
...
Fixes #1227
2015-04-30 07:47:44 -07:00
Brian Coca
09aa79c58f
Merge pull request #1102 from heiparta/extra_hosts
...
Add support for extra_hosts to docker module
2015-04-30 09:08:18 -04:00
Brian Coca
a811b9f12e
removed deprecated docs, not true anymore
2015-04-28 16:48:28 -04:00
Toshio Kuratomi
e95c0b2df3
Only split on the first colon.
...
Fixes #1214
2015-04-28 08:33:50 -07:00
Heikki Partanen
91ca2d6386
Add support for extra_hosts to docker module
...
extra_hosts parameter (maps to --add-host in 'docker run' syntax) is used
to add host-to-ip mappings to the container.
2015-04-07 10:30:14 +03:00
Andrew Davis
f38186ce8b
ansible_facts reflects 1.8 output
2015-04-03 12:41:10 -07:00
Ash Wilson
45b067f097
Record facts for each changed container.
2015-03-31 16:14:16 -04:00
Ash Wilson
b28459e6f5
Wait for process exit on detached=no.
2015-03-30 15:52:17 -04:00
Ryan Trauntvein
5320cc93e6
Specify that "state: reloaded" was added in Ansible 1.9
2015-03-27 16:36:10 -07:00
Ash Wilson
9ce2fc718a
Only fetch details when necessary.
2015-03-24 11:18:15 -04:00
Ash Wilson
47f4c3f2e5
Compare container images to Config.Image.
2015-03-24 11:07:12 -04:00
moncho
3421712e05
Update docker.py
...
Fix typo that prevents use_tls 'encrypt' option from working properly.
2015-03-19 19:30:36 +01:00
Toshio Kuratomi
76198a8223
Merge pull request #961 from nemunaire/fix-docker-version-print
...
[docker] Fix formating error when remote host doesn't have required version
2015-03-18 19:51:45 -07:00
Toshio Kuratomi
e338fef730
Add another valid status from downloading images
2015-03-18 18:27:01 -07:00
nemunaire
fce8c21176
Convert tuple items to string before format
2015-03-18 14:37:26 +01:00
Toshio Kuratomi
8658b82de7
Some code cleanup (removed unused variables and imports)
2015-03-16 11:58:03 -07:00
Toshio Kuratomi
34c4e0d495
Also use DOCKER_TLS_VERIFY env var to turn on tls verification
2015-03-16 11:43:52 -07:00
Toshio Kuratomi
ceda82603a
Merge pull request #947 from ansible/docker-tls-none
...
When no use_tls is not specified and no tls parameters are given we need to not attempt tls.
2015-03-16 11:29:14 -07:00
Toshio Kuratomi
b0d194ea94
Fix a potential bug in docker pull
2015-03-15 11:22:07 -07:00
Toshio Kuratomi
5b4d7a2182
When no use_tls is not specified and no tls parameters are given we need to not attempt tls.
2015-03-14 22:59:17 -07:00
Toshio Kuratomi
45637176dc
Merge branch 'volumes_from' of https://github.com/lorin/ansible-modules-core into lorin-volumes_from
...
Remove volumes_from altogether
Conflicts:
cloud/docker/docker.py
2015-03-13 13:42:40 -07:00
Toshio Kuratomi
e4a5b46cfb
Merge pull request #936 from ansible/docker-pid-mode
...
Make pid_mode parameter do minimum docker-py/docker server version checks
2015-03-13 11:50:46 -07:00
Toshio Kuratomi
81fc92bd66
Make state=running work for backwards compatibility with 1.8
2015-03-13 10:23:10 -07:00