Fixed python34 comparison issue

Signed-off-by: Zal Daroga <zaldaroga@yahoo.com>
This commit is contained in:
Zal Daroga 2017-12-12 16:17:29 -06:00 committed by Joffrey F
parent 55ee95b6d0
commit 4839baf877
3 changed files with 8 additions and 5 deletions

View File

@ -560,7 +560,7 @@ class Service(object):
def prioritized_networks(self):
prioritized_networks = OrderedDict(
sorted(self.networks.items(), key=lambda t: t[1].get('priority', 0), reverse=True))
sorted(self.networks.items(), key=lambda t: t[1].get('priority', 0) or 0, reverse=True))
return prioritized_networks
def connect_container_to_networks(self, container):

View File

@ -1278,7 +1278,8 @@ class CLITestCase(DockerClientTestCase):
self.base_dir = 'tests/fixtures/networks'
result = self.dispatch(['-f', 'ordered-networks.yml', 'up', '-d'])
assert 'Connecting to networks_bar\nConnecting to networks_foo' in result.stdout
assert 'Connecting to networks_buzz\nConnecting to networks_foo' \
'\nConnecting to networks_bar' in result.stdout
@v3_only()
def test_up_with_healthcheck(self):

View File

@ -4,10 +4,12 @@ services:
web:
image: busybox
command: top
networks: ["foo", "bar"]
networks: ["foo", "bar", "buzz"]
networks:
foo:
priority: 1
priority: 2
bar:
priority: 2
priority: 1
buzz:
priority: 3