Skip to content

Commit 5b471d4

Browse files
authored
Merge pull request #2704 from aiordache/cleanup
Fix condition to avoid syntax warning
2 parents 27e3fa3 + a0c51be commit 5b471d4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

docker/types/containers.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,15 +334,11 @@ def __init__(self, version, binds=None, port_bindings=None,
334334
if dns_search:
335335
self['DnsSearch'] = dns_search
336336

337-
if network_mode is 'host' and port_bindings:
337+
if network_mode == 'host' and port_bindings:
338338
raise host_config_incompatible_error(
339339
'network_mode', 'host', 'port_bindings'
340340
)
341-
342-
if network_mode:
343-
self['NetworkMode'] = network_mode
344-
elif network_mode is None:
345-
self['NetworkMode'] = 'default'
341+
self['NetworkMode'] = network_mode or 'default'
346342

347343
if restart_policy:
348344
if not isinstance(restart_policy, dict):

0 commit comments

Comments
 (0)