Code review comment for lp:~julian-edwards/maas/node-power-monitor-crash

Revision history for this message
Raphaƫl Badin (rvb) wrote :

Looks good but wouldn't the code be better placed directly inside perform_power_query()?

@synchronous
def perform_power_query(system_id, hostname, power_type, context):
    """Issue the given `power_query` command.

    No exception handling is performed here, this allows
    `get_power_state` to perform multiple queries and only
    log the final error.
    """
    action = PowerAction(power_type)
    power_state = action.execute(power_change='query', **context)
    if power_state in ("on", "off"):
        return power_state
    else:
        raise PowerActionFail(power_state)

review: Approve

« Back to merge proposal