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)
Looks good but wouldn't the code be better placed directly inside perform_ power_query( )?
@synchronous power_query( system_ id, hostname, power_type, context):
def perform_
"""Issue the given `power_query` command.
No exception handling is performed here, this allows power_state` to perform multiple queries and only power_type) execute( power_change= 'query' , **context) (power_ state)
`get_
log the final error.
"""
action = PowerAction(
power_state = action.
if power_state in ("on", "off"):
return power_state
else:
raise PowerActionFail