@classmethod
def check_state(cls, state, new_build):
    """checks if a state is allowed."""
    if not state in cls.states:
        raise ValueError('unknown state: %s' % repr(state))
    if new_build:
        if state == 'disabled':
            raise ValueError("state 'disabled' not allowed for a new build")
