def sync_cs_policybindings(client, module):
    log('Syncing cs policybindings')
    actual_bindings = get_actual_policybindings(client, module)
    configured_bindings = get_configured_policybindings(client, module)

    # Delete actual bindings not in configured
    delete_keys = list(
        set(actual_bindings.keys()) - set(configured_bindings.keys()))
    for key in delete_keys:
        log('Deleting binding for policy %s' % key)
        csvserver_cspolicy_binding.delete(client, actual_bindings[key])

    # Add configured bindings not in actual
    add_keys = list(
        set(configured_bindings.keys()) - set(actual_bindings.keys()))
    for key in add_keys:
        log('Adding binding for policy %s' % key)
        configured_bindings[key].add()

    # Update existing if changed
    modify_keys = list(
        set(configured_bindings.keys()) & set(actual_bindings.keys()))
    for key in modify_keys:
        if not configured_bindings[key].has_equal_attributes(
                actual_bindings[key]):
            log('Updating binding for policy %s' % key)
            csvserver_cspolicy_binding.delete(client, actual_bindings[key])
            configured_bindings[key].add()
Beispiel #2
0
    def sync_cs_policybindings():

        # Delete all actual bindings
        for binding in get_actual_policybindings().values():
            csvserver_cspolicy_binding.delete(client, binding)

        # Add all configured bindings

        for binding in get_configured_policybindings().values():
            binding.add()
def sync_cs_policybindings(client, module):
    log('Syncing cs policybindings')

    # Delete all actual bindings
    for binding in get_actual_policybindings(client, module).values():
        log('Deleting binding for policy %s' % binding.policyname)
        csvserver_cspolicy_binding.delete(client, binding)

    # Add all configured bindings

    for binding in get_configured_policybindings(client, module).values():
        log('Adding binding for policy %s' % binding.policyname)
        binding.add()
Beispiel #4
0
def sync_cs_policybindings(client, module):
    log('Syncing cs policybindings')

    # Delete all actual bindings
    for binding in get_actual_policybindings(client, module).values():
        log('Deleting binding for policy %s' % binding.policyname)
        csvserver_cspolicy_binding.delete(client, binding)

    # Add all configured bindings

    for binding in get_configured_policybindings(client, module).values():
        log('Adding binding for policy %s' % binding.policyname)
        binding.add()
def sync_cs_policybindings(client, module):
    log('Syncing cs policybindings')
    actual_bindings = get_actual_policybindings(client, module)
    configured_bindings = get_configured_policybindings(client, module)

    # Delete actual bindings not in configured
    delete_keys = list(set(actual_bindings.keys()) - set(configured_bindings.keys()))
    for key in delete_keys:
        log('Deleting binding for policy %s' % key)
        csvserver_cspolicy_binding.delete(client, actual_bindings[key])

    # Add configured bindings not in actual
    add_keys = list(set(configured_bindings.keys()) - set(actual_bindings.keys()))
    for key in add_keys:
        log('Adding binding for policy %s' % key)
        configured_bindings[key].add()

    # Update existing if changed
    modify_keys = list(set(configured_bindings.keys()) & set(actual_bindings.keys()))
    for key in modify_keys:
        if not configured_bindings[key].has_equal_attributes(actual_bindings[key]):
            log('Updating binding for policy %s' % key)
            csvserver_cspolicy_binding.delete(client, actual_bindings[key])
            configured_bindings[key].add()