Remove exit_on_stop from Watcher
We don't need exit_on_stop option now as we always set it to True. This commit removes it to simplify the code. Change-Id: I258709095727d87ede66ad6846c6e56ebdabec91
This commit is contained in:
parent
8532af26de
commit
94bb9f8804
@ -192,7 +192,7 @@ class CNIDaemonWatcherService(cotyledon.Service):
|
||||
self.pipeline = h_cni.CNIPipeline()
|
||||
self.pipeline.register(h_cni.CallbackHandler(self.on_done,
|
||||
self.on_deleted))
|
||||
self.watcher = k_watcher.Watcher(self.pipeline, exit_on_stop=True)
|
||||
self.watcher = k_watcher.Watcher(self.pipeline)
|
||||
self.watcher.add(
|
||||
"%(base)s/pods?fieldSelector=spec.nodeName=%(node_name)s" % {
|
||||
'base': k_const.K8S_API_BASE,
|
||||
|
@ -84,7 +84,7 @@ class KuryrK8sService(six.with_metaclass(KuryrK8sServiceMeta,
|
||||
|
||||
objects.register_locally_defined_vifs()
|
||||
pipeline = h_pipeline.ControllerPipeline(self.tg)
|
||||
self.watcher = watcher.Watcher(pipeline, self.tg, exit_on_stop=True)
|
||||
self.watcher = watcher.Watcher(pipeline, self.tg)
|
||||
self.health_manager = health.HealthServer()
|
||||
self.current_leader = None
|
||||
self.node_name = utils.get_node_name()
|
||||
|
@ -211,8 +211,7 @@ class TestWatcher(test_base.TestCase):
|
||||
|
||||
@staticmethod
|
||||
def _test_watch_create_watcher(path, handler, timeout=0):
|
||||
watcher_obj = watcher.Watcher(handler, timeout=timeout,
|
||||
exit_on_stop=True)
|
||||
watcher_obj = watcher.Watcher(handler, timeout=timeout)
|
||||
watcher_obj._running = True
|
||||
watcher_obj._resources.add(path)
|
||||
watcher_obj._idle[path] = True
|
||||
|
@ -56,8 +56,7 @@ class Watcher(health.HealthHandler):
|
||||
graceful=False)` for asynchronous `Watcher`).
|
||||
"""
|
||||
|
||||
def __init__(self, handler, thread_group=None, timeout=None,
|
||||
exit_on_stop=False):
|
||||
def __init__(self, handler, thread_group=None, timeout=None):
|
||||
"""Initializes a new Watcher instance.
|
||||
|
||||
:param handler: a `callable` object to be invoked for each observed
|
||||
@ -84,7 +83,6 @@ class Watcher(health.HealthHandler):
|
||||
if timeout is None:
|
||||
timeout = CONF.kubernetes.watch_retry_timeout
|
||||
self._timeout = timeout
|
||||
self._exit_on_stop = exit_on_stop
|
||||
|
||||
def add(self, path):
|
||||
"""Adds ths K8s resource to the Watcher.
|
||||
@ -161,11 +159,8 @@ class Watcher(health.HealthHandler):
|
||||
finally:
|
||||
if not self._watching and not self._idle:
|
||||
self.stop()
|
||||
if self._exit_on_stop:
|
||||
LOG.info("No remaining active watchers, Exiting...")
|
||||
# TODO(dulek): This complicates things, remove once we
|
||||
# don't support running without kuryr-daemon.
|
||||
sys.exit(1)
|
||||
LOG.info("No remaining active watchers, Exiting...")
|
||||
sys.exit(1)
|
||||
|
||||
def _watch(self, path):
|
||||
attempts = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user