Example #1
0
def _append_shares_to_device(ip, device, data, external_priorities={}):
    device_data = get_device_data(device)
    full_data = merge_data(
        data,
        {
            'database': {'device': device_data},
        },
        only_multiple=True,
    )
    append_merged_proposition(full_data, device, external_priorities)
    selected_data = select_data(full_data, external_priorities)
    for share_mount in selected_data.get('disk_shares', []):
        _create_or_update_share_mount(ip, device, share_mount)
Example #2
0
def _append_shares_to_device(ip, device, data, external_priorities={}):
    device_data = get_device_data(device)
    full_data = merge_data(
        data,
        {
            'database': {'device': device_data},
        },
        only_multiple=True,
    )
    append_merged_proposition(full_data, device, external_priorities)
    selected_data = select_data(full_data, external_priorities)
    parsed_mounts = set()
    for share_mount in selected_data.get('disk_shares', []):
        status, mount = _create_or_update_share_mount(ip, device, share_mount)
        if mount:
            parsed_mounts.add(mount.pk)
    device.disksharemount_set.exclude(pk__in=parsed_mounts).delete()
Example #3
0
def _append_shares_to_device(ip, device, data, external_priorities={}):
    device_data = get_device_data(device)
    full_data = merge_data(
        data,
        {
            'database': {
                'device': device_data
            },
        },
        only_multiple=True,
    )
    append_merged_proposition(full_data, device, external_priorities)
    selected_data = select_data(full_data, external_priorities)
    parsed_mounts = set()
    for share_mount in selected_data.get('disk_shares', []):
        status, mount = _create_or_update_share_mount(ip, device, share_mount)
        if mount:
            parsed_mounts.add(mount.pk)
    device.disksharemount_set.exclude(pk__in=parsed_mounts).delete()
Example #4
0
def _append_connections_to_device(device, data, external_priorities):
    device_data = get_device_data(device)
    full_data = merge_data(
        data,
        {
            'database': {'device': device_data},
        },
        only_multiple=True,
    )
    append_merged_proposition(full_data, device, external_priorities)
    selected_data = select_data(full_data, external_priorities)
    parsed_connections = set()
    for conn_data in selected_data.get('connections', []):
        conn = _create_or_update_connection(device, conn_data)
        if conn:
            parsed_connections.add(conn.pk)
    Connection.objects.filter(
        Q(outbound=device),
        Q(connection_type=ConnectionType.network),
        ~Q(pk__in=parsed_connections),
    ).delete()
Example #5
0
def _append_connections_to_device(device, data, external_priorities):
    device_data = get_device_data(device)
    full_data = merge_data(
        data,
        {
            'database': {'device': device_data},
        },
        only_multiple=True,
    )
    append_merged_proposition(full_data, device, external_priorities)
    selected_data = select_data(full_data, external_priorities)
    parsed_connections = set()
    for conn_data in selected_data.get('connections', []):
        conn = _create_or_update_connection(device, conn_data)
        if conn:
            parsed_connections.add(conn.pk)
    Connection.objects.filter(
        Q(outbound=device),
        Q(connection_type=ConnectionType.network),
        ~Q(pk__in=parsed_connections),
    ).delete()