summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Clark <steve@cobe.io>2017-09-18 11:35:53 +0100
committerJoffrey F <joffrey@docker.com>2017-11-06 19:20:36 -0800
commitd331e78a1c7df3e6355ca2f9593766492b55058b (patch)
tree7c52855f6c1876518f75eb47b8133644d0c3642a
parent4c13386d7b8c35f185686fe9fa7cddedb55d37e2 (diff)
downloaddocker-py-d331e78a1c7df3e6355ca2f9593766492b55058b.tar.gz
Adding swarm id_attribute to match docker output
Swarm id is returned in a attribute with the key ID. The swarm model was using the default behaviour and looking for Id. Signed-off-by: Steve Clark <steve@cobe.io>
-rw-r--r--docker/models/swarm.py2
-rw-r--r--tests/integration/models_swarm_test.py1
2 files changed, 3 insertions, 0 deletions
diff --git a/docker/models/swarm.py b/docker/models/swarm.py
index d3d07ee..df3afd3 100644
--- a/docker/models/swarm.py
+++ b/docker/models/swarm.py
@@ -9,6 +9,8 @@ class Swarm(Model):
The server's Swarm state. This a singleton that must be reloaded to get
the current state of the Swarm.
"""
+ id_attribute = 'ID'
+
def __init__(self, *args, **kwargs):
super(Swarm, self).__init__(*args, **kwargs)
if self.client:
diff --git a/tests/integration/models_swarm_test.py b/tests/integration/models_swarm_test.py
index ac18030..dadd77d 100644
--- a/tests/integration/models_swarm_test.py
+++ b/tests/integration/models_swarm_test.py
@@ -22,6 +22,7 @@ class SwarmTest(unittest.TestCase):
assert client.swarm.attrs['Spec']['Raft']['SnapshotInterval'] == 5000
client.swarm.update(snapshot_interval=10000)
assert client.swarm.attrs['Spec']['Raft']['SnapshotInterval'] == 10000
+ assert client.swarm.id
assert client.swarm.leave(force=True)
with self.assertRaises(docker.errors.APIError) as cm:
client.swarm.reload()