Comment 5 for bug 1508741

Gavin Panella (allenap) wrote :

I wonder if the UI calls MAAS's Web API rather than going via the
WebSocket API for this? If so, I can see an inconsistency in

class NodeHandler(OperationsHandler):
    def query_power_state(self, request, system_id):
        call = client(
            PowerQuery, system_id=system_id, hostname=node.hostname,
            state = call.wait(POWER_QUERY_TIMEOUT)
        except crochet.TimeoutError:
                "%s: Timed out waiting for power response in Node.power_state",
-->         raise PowerProblem("Timed out waiting for power response")
        except PowerActionFail as e:
            addTask(node.update_power_state, POWER_STATE.ERROR)
            raise PowerProblem(e)
        except NotImplementedError as e:
            addTask(node.update_power_state, POWER_STATE.UNKNOWN)
            raise PowerProblem(e)

Other call-sites for the PowerQuery RPC call deal with time-outs by
setting the power state to "error", whereas this only re-raises the
exception. Adding:

            addTask(node.update_power_state, POWER_STATE.ERROR)

to that except: block might be enough to fix this bug.