def get_state():
    """SDP State.

    Return current state; target state and allowed
    target states.
    """
    sdp_state = SDPState()
    errval, errdict = _check_status(sdp_state)
    if errval == "error":
        LOG.debug(errdict['reason'])
        return dict(
            current_state="unknown",
            target_state="unknown",
            last_updated="unknown",
            reason=errdict['reason']
        )
    _last_updated = sdp_state.current_timestamp
    if sdp_state.target_timestamp > _last_updated:
        _last_updated = sdp_state.target_timestamp

    return dict(
        current_state=sdp_state.current_state,
        target_state=sdp_state.target_state,
        allowed_target_states=sdp_state.allowed_target_states[
            sdp_state.current_state],
        last_updated=_last_updated.isoformat()
    ), HTTPStatus.OK
def get_state ( ) : sdp_state = SDPState ( ) errval , errdict = _check_status ( sdp_state ) if errval == "error" : LOG . debug ( errdict [ 'reason' ] ) return dict ( current_state = "unknown" , target_state = "unknown" , last_updated = "unknown" , reason = errdict [ 'reason' ] ) _last_updated = sdp_state . current_timestamp if sdp_state . target_timestamp > _last_updated : _last_updated = sdp_state . target_timestamp return dict ( current_state = sdp_state . current_state , target_state = sdp_state . target_state , allowed_target_states = sdp_state . allowed_target_states [ sdp_state . current_state ] , last_updated = _last_updated . isoformat ( ) ) , HTTPStatus . OK
SDP State.

    Return current state; target state and allowed
    target states.