mirror of https://github.com/docker/docker-py.git
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>
This commit is contained in:
parent
be3900b806
commit
ca435af52e
|
@ -9,6 +9,8 @@ class Swarm(Model):
|
||||||
The server's Swarm state. This a singleton that must be reloaded to get
|
The server's Swarm state. This a singleton that must be reloaded to get
|
||||||
the current state of the Swarm.
|
the current state of the Swarm.
|
||||||
"""
|
"""
|
||||||
|
id_attribute = 'ID'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Swarm, self).__init__(*args, **kwargs)
|
super(Swarm, self).__init__(*args, **kwargs)
|
||||||
if self.client:
|
if self.client:
|
||||||
|
|
|
@ -22,6 +22,7 @@ class SwarmTest(unittest.TestCase):
|
||||||
assert client.swarm.attrs['Spec']['Raft']['SnapshotInterval'] == 5000
|
assert client.swarm.attrs['Spec']['Raft']['SnapshotInterval'] == 5000
|
||||||
client.swarm.update(snapshot_interval=10000)
|
client.swarm.update(snapshot_interval=10000)
|
||||||
assert client.swarm.attrs['Spec']['Raft']['SnapshotInterval'] == 10000
|
assert client.swarm.attrs['Spec']['Raft']['SnapshotInterval'] == 10000
|
||||||
|
assert client.swarm.id
|
||||||
assert client.swarm.leave(force=True)
|
assert client.swarm.leave(force=True)
|
||||||
with self.assertRaises(docker.errors.APIError) as cm:
|
with self.assertRaises(docker.errors.APIError) as cm:
|
||||||
client.swarm.reload()
|
client.swarm.reload()
|
||||||
|
|
Loading…
Reference in New Issue