Commit a5229439 authored by Guido Trotter's avatar Guido Trotter
Browse files

confd/client: make it possible to update peer list



Until now the peers have to be the same all the time. Adding a new
function to update the list, and call it from the constructor to avoid
duplicating code.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 834f8b67
......@@ -101,12 +101,10 @@ class ConfdClient:
@keyword logger: optional logger for internal conditions
"""
if not isinstance(peers, list):
raise errors.ProgrammerError("peers must be a list")
if not callable(callback):
raise errors.ProgrammerError("callback must be callable")
self._peers = peers
self.UpdatePeerList(peers)
self._hmac_key = hmac_key
self._socket = ConfdAsyncUDPClient(self)
self._callback = callback
......@@ -118,6 +116,17 @@ class ConfdClient:
if self._confd_port is None:
self._confd_port = utils.GetDaemonPort(constants.CONFD)
def UpdatePeerList(self, peers):
"""Update the list of peers
@type peers: list
@param peers: list of peer nodes
"""
if not isinstance(peers, list):
raise errors.ProgrammerError("peers must be a list")
self._peers = peers
def _PackRequest(self, request, now=None):
"""Prepare a request to be sent on the wire.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment