

def managed(name, peers=None):
    '\n    Updates the list of NTP peers on the devices as speified in the state SLS file.\n    NTP peers not specified in this list will be removed and peers that are not configured will be set.\n\n\n    SLS Example:\n\n    .. code-block:: yaml\n\n        netntp_example:\n            netntp.managed:\n                 - peers:\n                    - 192.168.0.1\n                    - 172.17.17.1\n    '
    result = False
    comment = ''
    changes = dict()
    ret = {
        'name': name,
        'changes': changes,
        'result': result,
        'comment': _set,
    }
    if (not _check_peers(peers)):
        ret['comment'] = 'NTP peers must be a list of valid IP Addresses or Domain Names'
        return ret
    ntp_peers_output = _retrieve_ntp_peers()
    if (not ntp_peers_output.get('result')):
        ret['comment'] = 'Cannot retrieve NTP peers from the device: {reason}'.format(reason=ntp_peers_output.get('comment'))
        return ret
    configured_ntp_peers = set(ntp_peers_output.get('out', {
        
    }))
    desired_ntp_peers = set(peers)
    if (configured_ntp_peers == desired_ntp_peers):
        ret.update({
            'comment': 'NTP peers already configured as needed.',
            'result': True,
        })
        if (__opts__['test'] is True):
            ret.update({
                'result': None,
            })
        return ret
    peers_to_set = list((desired_ntp_peers - configured_ntp_peers))
    peers_to_delete = list((configured_ntp_peers - desired_ntp_peers))
    changes = {
        'added': peers_to_set,
        'removed': peers_to_delete,
    }
    ret.update({
        'changes': changes,
    })
    if (__opts__['test'] is True):
        ret.update({
            'result': None,
            'comment': 'Testing mode: the device configuration was not changed!',
        })
        return ret
    expected_config_change = False
    successfully_changed = True
    if peers_to_set:
        _set = _set_ntp_peers(peers_to_set)
        if _set.get('result'):
            expected_config_change = True
        else:
            successfully_changed = False
            comment += 'Cannot set NTP peers: {reason}'.format(reason=_set.get('comment'))
    if peers_to_delete:
        _removed = _delete_ntp_peers(peers_to_delete)
        if _removed.get('result'):
            expected_config_change = True
        else:
            successfully_changed = False
            comment += 'Cannot remove NTP peers: {reason}'.format(reason=_removed.get('comment'))
    if expected_config_change:
        (config_result, config_comment) = __salt__['net.config_control']()
        result = (config_result and successfully_changed)
        comment += config_comment
    ret.update({
        'result': result,
        'comment': comment,
    })
    return ret

dataset/ETHPy150Open saltstack/salt/salt/states/netntp.py managed/VarMisuse@51/215 `comment`->`_set`