diff options
author | Steve Clark <steve@cobe.io> | 2017-09-18 11:35:53 +0100 |
---|---|---|
committer | Joffrey F <f.joffrey@gmail.com> | 2017-09-21 22:40:10 -0700 |
commit | ca435af52e06b2c189708a749372708ff69161ff (patch) | |
tree | 92c7a3e029db06714e4a09e35ae7c926c3c5815b | |
parent | be3900b806cf48933643757077f3b77d9c3f4593 (diff) | |
download | docker-py-ca435af52e06b2c189708a749372708ff69161ff.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.py | 2 | ||||
-rw-r--r-- | tests/integration/models_swarm_test.py | 1 |
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() |