From b140e26f0a55a3d11c8bb76275ce065e0862fe38 Mon Sep 17 00:00:00 2001 From: Hugo LEVY-FALK Date: Sat, 4 Aug 2018 09:54:17 +0200 Subject: [PATCH] =?UTF-8?q?Suppression=20des=20migrations=20pr=C3=A9c?= =?UTF-8?q?=C3=A9demment=20fusionn=C3=A9es.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0062_auto_20180627_0123.py | 25 ------- .../migrations/0063_port_custom_profil.py | 21 ------ topologie/migrations/0064_createprofil.py | 53 ------------- .../migrations/0065_auto_20180630_1703.py | 23 ------ .../migrations/0066_auto_20180630_1855.py | 25 ------- .../migrations/0067_auto_20180701_0016.py | 75 ------------------- 6 files changed, 222 deletions(-) delete mode 100644 topologie/migrations/0062_auto_20180627_0123.py delete mode 100644 topologie/migrations/0063_port_custom_profil.py delete mode 100644 topologie/migrations/0064_createprofil.py delete mode 100644 topologie/migrations/0065_auto_20180630_1703.py delete mode 100644 topologie/migrations/0066_auto_20180630_1855.py delete mode 100644 topologie/migrations/0067_auto_20180701_0016.py diff --git a/topologie/migrations/0062_auto_20180627_0123.py b/topologie/migrations/0062_auto_20180627_0123.py deleted file mode 100644 index b8135de8..00000000 --- a/topologie/migrations/0062_auto_20180627_0123.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10.7 on 2018-06-26 23:23 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('topologie', '0061_portprofile'), - ] - - operations = [ - migrations.AlterField( - model_name='portprofile', - name='radius_mode', - field=models.CharField(choices=[('STRICT', 'STRICT'), ('COMMON', 'COMMON')], default='COMMON', help_text="En cas d'auth par mac, auth common ou strcit sur le port", max_length=32, verbose_name='RADIUS mode'), - ), - migrations.AlterField( - model_name='portprofile', - name='radius_type', - field=models.CharField(choices=[('NO', 'NO'), ('802.1X', '802.1X'), ('MAC-radius', 'MAC-radius')], help_text="Choix du type d'authentification radius : non actif, mac ou 802.1X", max_length=32, verbose_name='RADIUS type'), - ), - ] diff --git a/topologie/migrations/0063_port_custom_profil.py b/topologie/migrations/0063_port_custom_profil.py deleted file mode 100644 index 15feebce..00000000 --- a/topologie/migrations/0063_port_custom_profil.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10.7 on 2018-06-28 07:49 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('topologie', '0062_auto_20180627_0123'), - ] - - operations = [ - migrations.AddField( - model_name='port', - name='custom_profil', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='topologie.PortProfile'), - ), - ] diff --git a/topologie/migrations/0064_createprofil.py b/topologie/migrations/0064_createprofil.py deleted file mode 100644 index 2f165386..00000000 --- a/topologie/migrations/0064_createprofil.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10.7 on 2017-12-31 19:53 -from __future__ import unicode_literals - -from django.db import migrations - - -def transfer_profil(apps, schema_editor): - db_alias = schema_editor.connection.alias - port = apps.get_model("topologie", "Port") - profil = apps.get_model("topologie", "PortProfile") - vlan = apps.get_model("machines", "Vlan") - port_list = port.objects.using(db_alias).all() - profil_nothing = profil.objects.using(db_alias).create(name='nothing', profil_default='nothing', radius_type='NO') - profil_uplink = profil.objects.using(db_alias).create(name='uplink', profil_default='uplink', radius_type='NO') - profil_machine = profil.objects.using(db_alias).create(name='asso_machine', profil_default='asso_machine', radius_type='NO') - profil_room = profil.objects.using(db_alias).create(name='room', profil_default='room', radius_type='NO') - profil_borne = profil.objects.using(db_alias).create(name='accesspoint', profil_default='accesspoint', radius_type='NO') - for vlan_instance in vlan.objects.using(db_alias).all(): - if port.objects.using(db_alias).filter(vlan_force=vlan_instance): - custom_profil = profil.objects.using(db_alias).create(name='vlan-force-' + str(vlan_instance.vlan_id), radius_type='NO', vlan_untagged=vlan_instance) - port.objects.using(db_alias).filter(vlan_force=vlan_instance).update(custom_profil=custom_profil) - if port.objects.using(db_alias).filter(room__isnull=False).filter(radius='STRICT').count() > port.objects.using(db_alias).filter(room__isnull=False).filter(radius='NO').count() and port.objects.using(db_alias).filter(room__isnull=False).filter(radius='STRICT').count() > port.objects.using(db_alias).filter(room__isnull=False).filter(radius='COMMON').count(): - profil_room.radius_type = 'MAC-radius' - profil_room.radius_mode = 'STRICT' - common_profil = profil.objects.using(db_alias).create(name='mac-radius-common', radius_type='MAC-radius', radius_mode='COMMON') - no_rad_profil = profil.objects.using(db_alias).create(name='no-radius', radius_type='NO') - port.objects.using(db_alias).filter(room__isnull=False).filter(radius='COMMON').update(custom_profil=common_profil) - port.objects.using(db_alias).filter(room__isnull=False).filter(radius='NO').update(custom_profil=no_rad_profil) - elif port.objects.using(db_alias).filter(room__isnull=False).filter(radius='COMMON').count() > port.objects.using(db_alias).filter(room__isnull=False).filter(radius='NO').count() and port.objects.using(db_alias).filter(room__isnull=False).filter(radius='COMMON').count() > port.objects.using(db_alias).filter(room__isnull=False).filter(radius='STRICT').count(): - profil_room.radius_type = 'MAC-radius' - profil_room.radius_mode = 'COMMON' - strict_profil = profil.objects.using(db_alias).create(name='mac-radius-strict', radius_type='MAC-radius', radius_mode='STRICT') - no_rad_profil = profil.objects.using(db_alias).create(name='no-radius', radius_type='NO') - port.objects.using(db_alias).filter(room__isnull=False).filter(radius='STRICT').update(custom_profil=strict_profil) - port.objects.using(db_alias).filter(room__isnull=False).filter(radius='NO').update(custom_profil=no_rad_profil) - else: - strict_profil = profil.objects.using(db_alias).create(name='mac-radius-strict', radius_type='MAC-radius', radius_mode='STRICT') - common_profil = profil.objects.using(db_alias).create(name='mac-radius-common', radius_type='MAC-radius', radius_mode='COMMON') - port.objects.using(db_alias).filter(room__isnull=False).filter(radius='STRICT').update(custom_profil=strict_profil) - port.objects.using(db_alias).filter(room__isnull=False).filter(radius='NO').update(custom_profil=common_profil) - profil_room.save() - - -class Migration(migrations.Migration): - - dependencies = [ - ('topologie', '0063_port_custom_profil'), - ] - - operations = [ - migrations.RunPython(transfer_profil), - ] diff --git a/topologie/migrations/0065_auto_20180630_1703.py b/topologie/migrations/0065_auto_20180630_1703.py deleted file mode 100644 index 9fed2d83..00000000 --- a/topologie/migrations/0065_auto_20180630_1703.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10.7 on 2018-06-30 15:03 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('topologie', '0064_createprofil'), - ] - - operations = [ - migrations.RemoveField( - model_name='port', - name='radius', - ), - migrations.RemoveField( - model_name='port', - name='vlan_force', - ), - ] diff --git a/topologie/migrations/0066_auto_20180630_1855.py b/topologie/migrations/0066_auto_20180630_1855.py deleted file mode 100644 index b197f568..00000000 --- a/topologie/migrations/0066_auto_20180630_1855.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10.7 on 2018-06-30 16:55 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('topologie', '0065_auto_20180630_1703'), - ] - - operations = [ - migrations.AddField( - model_name='port', - name='state', - field=models.BooleanField(default=True, help_text='Etat du port Actif', verbose_name='Etat du port Actif'), - ), - migrations.AlterField( - model_name='portprofile', - name='profil_default', - field=models.CharField(blank=True, choices=[('room', 'room'), ('accespoint', 'accesspoint'), ('uplink', 'uplink'), ('asso_machine', 'asso_machine'), ('nothing', 'nothing')], max_length=32, null=True, unique=True, verbose_name='profil default'), - ), - ] diff --git a/topologie/migrations/0067_auto_20180701_0016.py b/topologie/migrations/0067_auto_20180701_0016.py deleted file mode 100644 index 578ee7d6..00000000 --- a/topologie/migrations/0067_auto_20180701_0016.py +++ /dev/null @@ -1,75 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.10.7 on 2018-06-30 22:16 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('topologie', '0066_auto_20180630_1855'), - ] - - operations = [ - migrations.RenameField( - model_name='port', - old_name='custom_profil', - new_name='custom_profile', - ), - migrations.AlterField( - model_name='port', - name='state', - field=models.BooleanField(default=True, help_text='Port state Active', verbose_name='Port State Active'), - ), - migrations.AlterField( - model_name='portprofile', - name='arp_protect', - field=models.BooleanField(default=False, help_text='Check if ip is dhcp assigned', verbose_name='Arp protect'), - ), - migrations.AlterField( - model_name='portprofile', - name='dhcp_snooping', - field=models.BooleanField(default=False, help_text='Protect against rogue dhcp', verbose_name='Dhcp snooping'), - ), - migrations.AlterField( - model_name='portprofile', - name='dhcpv6_snooping', - field=models.BooleanField(default=False, help_text='Protect against rogue dhcpv6', verbose_name='Dhcpv6 snooping'), - ), - migrations.AlterField( - model_name='portprofile', - name='flow_control', - field=models.BooleanField(default=False, help_text='Flow control', verbose_name='Flow control'), - ), - migrations.AlterField( - model_name='portprofile', - name='loop_protect', - field=models.BooleanField(default=False, help_text='Protect again loop', verbose_name='Loop Protect'), - ), - migrations.AlterField( - model_name='portprofile', - name='mac_limit', - field=models.IntegerField(blank=True, help_text='Limit of mac-address on this port', null=True, verbose_name='Mac limit'), - ), - migrations.AlterField( - model_name='portprofile', - name='ra_guard', - field=models.BooleanField(default=False, help_text='Protect against rogue ra', verbose_name='Ra guard'), - ), - migrations.AlterField( - model_name='portprofile', - name='radius_mode', - field=models.CharField(choices=[('STRICT', 'STRICT'), ('COMMON', 'COMMON')], default='COMMON', help_text='In case of mac-auth : mode common or strict on this port', max_length=32, verbose_name='RADIUS mode'), - ), - migrations.AlterField( - model_name='portprofile', - name='radius_type', - field=models.CharField(choices=[('NO', 'NO'), ('802.1X', '802.1X'), ('MAC-radius', 'MAC-radius')], help_text='Type of radius auth : inactive, mac-address or 802.1X', max_length=32, verbose_name='RADIUS type'), - ), - migrations.AlterField( - model_name='portprofile', - name='speed', - field=models.CharField(choices=[('10-half', '10-half'), ('100-half', '100-half'), ('10-full', '10-full'), ('100-full', '100-full'), ('1000-full', '1000-full'), ('auto', 'auto'), ('auto-10', 'auto-10'), ('auto-100', 'auto-100')], default='auto', help_text='Port speed limit', max_length=32, verbose_name='Speed'), - ), - ]