Merge lp://staging/~julian-edwards/maas/node-power-monitor-crash into lp://staging/~maas-committers/maas/trunk

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 3026
Proposed branch: lp://staging/~julian-edwards/maas/node-power-monitor-crash
Merge into: lp://staging/~maas-committers/maas/trunk
Diff against target: 50 lines (+29/-0)
2 files modified
src/provisioningserver/rpc/power.py (+3/-0)
src/provisioningserver/rpc/tests/test_power.py (+26/-0)
To merge this branch: bzr merge lp://staging/~julian-edwards/maas/node-power-monitor-crash
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+235085@code.staging.launchpad.net

Commit message

Ensure crazy power template results are treated as errors in the power monitoring service. Crazy means not an "on" or a "off". Previously, it would halt the whole scan.

To post a comment you must log in.
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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.