Don't set next state on missing subnode

When some subnodes of a slot-host have already expired or removed some
other way, we can currently no longer set the next node state for all
still existing subnodes.

Fix this by checking if we could find a subnode before attempting to set
the next state.

Traceback (most recent call last):
  File ""/opt/zuul/lib/python3.13/site-packages/cherrypy/_cprequest.py"", line 659, in respond
    self._do_respond(path_info)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File ""/opt/zuul/lib/python3.13/site-packages/cherrypy/_cprequest.py"", line 718, in _do_respond
    response.body = self.handler()
                    ~~~~~~~~~~~~^^
  File ""/opt/zuul/lib/python3.13/site-packages/cherrypy/lib/encoding.py"", line 223, in __call__
    self.body = self.oldhandler(*args, **kwargs)
                ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File ""/opt/zuul/lib/python3.13/site-packages/cherrypy/lib/jsontools.py"", line 59, in json_handler
    value = cherrypy.serving.request._json_inner_handler(*args, **kwargs)
  File ""/opt/zuul/lib/python3.13/site-packages/cherrypy/_cpdispatch.py"", line 54, in __call__
    return self.callable(*self.args, **self.kwargs)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ""/opt/zuul/lib/python3.13/site-packages/zuul/web/__init__.py"", line 2917, in nodes_put
    nodes = self.zuulweb.launcher.setNextNodeState(
        node, state,
        cache=self.zuulweb.nodes_cache)
  File ""/opt/zuul/lib/python3.13/site-packages/zuul/launcher/client.py"", line 414, in setNextNodeState
    n.setNextState(ctx, next_state)
    ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'setNextState'"

Change-Id: I955588f0e850487ae9be763f892609ef641ce541
This commit is contained in:
Simon Westphahl
2026-07-02 13:52:47 +02:00
parent 2a0a5b9769
commit ca61135d0b
+3
View File
@@ -411,6 +411,9 @@ class LauncherClient:
with self.createZKContext(None, self.log) as ctx:
for n in nodes:
if n is None:
# Subnode no longer exists
continue
n.setNextState(ctx, next_state)
return nodes