From 9f12fd0a265d70d0c1d98ee5663d16e36b069f8e Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Thu, 25 Jun 2015 17:11:38 -0500 Subject: [PATCH] Default net to 'bridge' in container diff This prevents an unnecessary reload when the `net` parameter is unspecified (i.e. almost always). --- lib/ansible/modules/cloud/docker/docker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/docker/docker.py b/lib/ansible/modules/cloud/docker/docker.py index 1ccae96cc89..853cd1259c8 100644 --- a/lib/ansible/modules/cloud/docker/docker.py +++ b/lib/ansible/modules/cloud/docker/docker.py @@ -1115,8 +1115,8 @@ class DockerManager(object): # NETWORK MODE - expected_netmode = self.module.params.get('net') or '' - actual_netmode = container['HostConfig']['NetworkMode'] + expected_netmode = self.module.params.get('net') or 'bridge' + actual_netmode = container['HostConfig']['NetworkMode'] or 'bridge' if actual_netmode != expected_netmode: self.reload_reasons.append('net ({0} => {1})'.format(actual_netmode, expected_netmode)) differing.append(container)