diff --git a/docker/models/swarm.py b/docker/models/swarm.py index d3d07ee7..df3afd36 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 ac180305..dadd77d9 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()