예제 #1
0
def apply(desired_state, verify_change=True, commit=True, rollback_timeout=60):
    """
    Apply the desired state

    :param verify_change: Check if the outcome state matches the desired state
        and rollback if not.
    :param commit: Commit the changes after verification if the state matches.
    :param rollback_timeout: Revert the changes if they are not commited within
        this timeout (specified in seconds).
    :type verify_change: bool
    :type commit: bool
    :type rollback_timeout: int (seconds)
    :returns: Checkpoint identifier
    :rtype: str
    """
    desired_state = copy.deepcopy(desired_state)
    validator.validate(desired_state)
    validator.validate_capabilities(desired_state, netinfo.capabilities())
    validator.validate_dhcp(desired_state)
    validator.validate_dns(desired_state)

    checkpoint = _apply_ifaces_state(
        state.State(desired_state), verify_change, commit, rollback_timeout
    )
    if checkpoint:
        return str(checkpoint.dbuspath)
예제 #2
0
파일: netapplier.py 프로젝트: EdDev/nmstate
def apply(desired_state):
    validator.verify(desired_state)
    validator.verify_capabilities(desired_state, netinfo.capabilities())

    interfaces_current_state = netinfo.interfaces()

    _apply_ifaces_state(desired_state['interfaces'], interfaces_current_state)
예제 #3
0
def apply(desired_state, verify_change=True):
    desired_state = copy.deepcopy(desired_state)
    validator.verify(desired_state)
    validator.verify_capabilities(desired_state, netinfo.capabilities())
    validator.verify_dhcp(desired_state)

    _apply_ifaces_state(desired_state[Constants.INTERFACES], verify_change)
예제 #4
0
def apply(desired_state, verify_change=True):
    validator.verify(desired_state)
    validator.verify_capabilities(desired_state, netinfo.capabilities())

    _apply_ifaces_state(desired_state['interfaces'], verify_change)