|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +from __future__ import unicode_literals |
| 3 | + |
| 4 | +import datetime |
| 5 | +from django.db import migrations |
| 6 | + |
| 7 | +import debug # pyflakes:ignore |
| 8 | + |
| 9 | +definite_bof_conc = [ |
| 10 | + 'afic', |
| 11 | + 'dnsevolv', |
| 12 | + 'fddifs', |
| 13 | + 'icp', |
| 14 | + 'ietfgrow', |
| 15 | + 'ios', |
| 16 | + 'ipdecide', |
| 17 | + 'mailftp', |
| 18 | + 'osiextnd', |
| 19 | + 'ramp', |
| 20 | + 'skey', |
| 21 | + 'termacct', |
| 22 | + 'tpcint', |
| 23 | + 'usm', |
| 24 | + 'vtp', |
| 25 | +] |
| 26 | + |
| 27 | +maybe_bof_conc = [ |
| 28 | + 'ima', |
| 29 | + 'nsfnet', |
| 30 | + 'resdisc', |
| 31 | + 'shr', |
| 32 | + 'tadmin', |
| 33 | + 'tsess', |
| 34 | + 'txwg', |
| 35 | + 'x3s3.3', |
| 36 | +] |
| 37 | + |
| 38 | +had_no_parent = { |
| 39 | + 'acct2': 'ops-old', |
| 40 | + 'gisd': 'ops-old', |
| 41 | + 'ire': 'ops-old', |
| 42 | + 'newdom': 'ops-old', |
| 43 | + 'ucp': 'ops-old', |
| 44 | + 'dfs': 'usv', |
| 45 | +} |
| 46 | + |
| 47 | +make_into_team = [ |
| 48 | + 'isoc-old', |
| 49 | + 'iahc', |
| 50 | +] |
| 51 | + |
| 52 | +change_parents = { |
| 53 | + 'bgpdepl': {'old':'ops','new':'ops-old'}, |
| 54 | + 'cidrd': {'old':'ops','new':'ops-old'}, |
| 55 | + 'eii': {'old':'ops','new':'ops-old'}, |
| 56 | + 'netstat': {'old':'ops','new':'ops-old'}, |
| 57 | + 'njm': {'old':'ops','new':'ops-old'}, |
| 58 | + 'noop': {'old':'osi','new':'ops-old'}, |
| 59 | + 'opstat': {'old':'ops','new':'ops-old'}, |
| 60 | + 'thinosi': {'old':'app','new':'osi'}, |
| 61 | + 'wpkops': {'old':'ops','new':'ops-old'}, |
| 62 | + 'poised': {'old':'adm','new':'gen'}, |
| 63 | + 'poised95': {'old':'adm','new':'gen'}, |
| 64 | + 'ietfgrow': {'old':'adm','new':'gen'}, |
| 65 | + 'stdguide': {'old':'adm','new':'usv'}, |
| 66 | + 'inaparch': {'old':'adm','new':'gen'}, |
| 67 | + 'intprop': {'old':'adm','new':'gen'}, |
| 68 | + 'iahc': {'old':'adm', 'new':'gen' }, |
| 69 | + 'newgen': {'old':'adm', 'new':'gen' }, |
| 70 | + |
| 71 | +} |
| 72 | + |
| 73 | + |
| 74 | +def forward(apps, schema_editor): |
| 75 | + Group = apps.get_model('group','Group') |
| 76 | + Document = apps.get_model('doc','Document') |
| 77 | + |
| 78 | + |
| 79 | + # Verify assumptions |
| 80 | + for acronym in definite_bof_conc: |
| 81 | + assert Group.objects.filter(acronym=acronym,state_id='conclude').exists(), '%s not found or not concluded'%acronym |
| 82 | + for acronym in maybe_bof_conc: |
| 83 | + assert Group.objects.filter(acronym=acronym,state_id='conclude').exists(), '%s not found or not concluded'%acronym |
| 84 | + |
| 85 | + for acronym in had_no_parent: |
| 86 | + assert Group.objects.filter(acronym=acronym,parent__isnull=True).exists(), '%s not found or has a parent' % acronym |
| 87 | + for acronym in change_parents: |
| 88 | + assert Group.objects.filter(acronym=acronym,parent__acronym=change_parents[acronym]['old']).exists(),'%s not found or parent is not %s'%(acronym,change_parents[acronym]['old']) |
| 89 | + |
| 90 | + for acronym in make_into_team: |
| 91 | + assert Group.objects.filter(acronym=acronym,type_id='wg').exists(),'%s not found or is not a WG'%acronym |
| 92 | + |
| 93 | + Group.objects.filter(acronym__in=definite_bof_conc).update(state_id='bof-conc') |
| 94 | + Group.objects.filter(acronym__in=maybe_bof_conc).update(state_id='bof-conc') |
| 95 | + |
| 96 | + for acronym in had_no_parent: |
| 97 | + g=Group.objects.get(acronym=acronym) |
| 98 | + g.parent = Group.objects.get(acronym=had_no_parent[acronym]) |
| 99 | + g.save() |
| 100 | + |
| 101 | + for acronym in change_parents: |
| 102 | + g=Group.objects.get(acronym=acronym) |
| 103 | + g.parent = Group.objects.get(acronym=change_parents[acronym]['new']) |
| 104 | + g.save() |
| 105 | + |
| 106 | + for acronym in make_into_team: |
| 107 | + g=Group.objects.get(acronym=acronym) |
| 108 | + g.type_id='team' |
| 109 | + g.save() |
| 110 | + |
| 111 | + gen = Group.objects.get(acronym='gen') |
| 112 | + Document.objects.filter(name='draft-rescorla-sec-cons').update(group=gen) |
| 113 | + |
| 114 | + Group.objects.filter(acronym='adm').delete() |
| 115 | + |
| 116 | +def reverse(apps, schema_editor): |
| 117 | + Group = apps.get_model('group','Group') |
| 118 | + ChangeStateGroupEvent = apps.get_model('group','ChangeStateGroupEvent') |
| 119 | + Person = apps.get_model('person','Person') |
| 120 | + Document = apps.get_model('doc','Document') |
| 121 | + |
| 122 | + # Reconstitute the adm area |
| 123 | + |
| 124 | + adm = Group.objects.create(acronym='adm', |
| 125 | + type_id='area', |
| 126 | + name='ops', |
| 127 | + state_id='unknown', |
| 128 | + parent = Group.objects.get(acronym='iesg'), |
| 129 | + ) |
| 130 | + |
| 131 | + Group.objects.filter(acronym__in=definite_bof_conc).update(state_id='conclude') |
| 132 | + Group.objects.filter(acronym__in=maybe_bof_conc).update(state_id='conclude') |
| 133 | + |
| 134 | + for acronym in had_no_parent: |
| 135 | + g=Group.objects.get(acronym=acronym) |
| 136 | + g.parent_id = None |
| 137 | + g.save() |
| 138 | + |
| 139 | + for acronym in change_parents: |
| 140 | + g=Group.objects.get(acronym=acronym) |
| 141 | + g.parent = Group.objects.get(acronym=change_parents[acronym]['old']) |
| 142 | + g.save() |
| 143 | + |
| 144 | + for acronym in make_into_team: |
| 145 | + g=Group.objects.get(acronym=acronym) |
| 146 | + g.type_id = 'wg' |
| 147 | + g.save() |
| 148 | + |
| 149 | + adm.communitylist_set.create() |
| 150 | + |
| 151 | + create_time = datetime.datetime(2011,12,9,12,0,0) |
| 152 | + event_time = datetime.datetime(1997,1,1,12, 0,0) |
| 153 | + system = Person.objects.get(name='(System)') |
| 154 | + names = [ |
| 155 | + 'Dr. Borka Jerman-Blazic', |
| 156 | + 'Stephen J. Coya', |
| 157 | + 'Piet Bovenga', |
| 158 | + 'Bernhard Stockman', |
| 159 | + 'Paul-Andre Pays', |
| 160 | + 'Brian Gilmore', |
| 161 | + 'Jill Foster', |
| 162 | + 'Dr. Klaus Truoel', |
| 163 | + 'Jean-Paul Le Guigner', |
| 164 | + 'Urs Eppenberger', |
| 165 | + 'Christian Tschudin', |
| 166 | + 'David Oran', |
| 167 | + ] |
| 168 | + persons = dict() |
| 169 | + for name in names: |
| 170 | + persons[name] = Person.objects.get(name=name) |
| 171 | + |
| 172 | + adm.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 173 | + adm.role_set.create(name_id='ad',person=persons['David Oran'],email=persons['David Oran'].email_set.first()) |
| 174 | + |
| 175 | + g = Group.objects.create(name='Working Group on International Character Sets', |
| 176 | + acronym='wg-char', |
| 177 | + time=create_time, |
| 178 | + parent=adm, |
| 179 | + type_id='wg', |
| 180 | + state_id='conclude') |
| 181 | + ChangeStateGroupEvent.objects.create(group=g,time=event_time,by=system,desc='Concluded group',state_id='conclude') |
| 182 | + g.role_set.create(name_id='chair',person=persons['Dr. Borka Jerman-Blazic'],email=persons['Dr. Borka Jerman-Blazic'].email_set.first()) |
| 183 | + g.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 184 | + g = Group.objects.create(name='Informational Services and User Support', |
| 185 | + acronym='wg-isus', |
| 186 | + time=create_time, |
| 187 | + parent=adm, |
| 188 | + type_id='wg', |
| 189 | + state_id='conclude') |
| 190 | + ChangeStateGroupEvent.objects.create(group=g,time=event_time,by=system,desc='Concluded group',state_id='conclude') |
| 191 | + g.role_set.create(name_id='chair',person=persons['Jill Foster'],email=persons['Jill Foster'].email_set.first()) |
| 192 | + g.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 193 | + g = Group.objects.create(name='Lower Layers Technology', |
| 194 | + acronym='wg-llt', |
| 195 | + time=create_time, |
| 196 | + parent=adm, |
| 197 | + type_id='wg', |
| 198 | + state_id='conclude') |
| 199 | + ChangeStateGroupEvent.objects.create(group=g,time=event_time,by=system,desc='Concluded group',state_id='conclude') |
| 200 | + g.role_set.create(name_id='chair',person=persons['Piet Bovenga'],email=persons['Piet Bovenga'].email_set.first()) |
| 201 | + g.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 202 | + g = Group.objects.create(name='Network Applications Support', |
| 203 | + acronym='wg-nap', |
| 204 | + time=create_time, |
| 205 | + parent=adm, |
| 206 | + type_id='wg', |
| 207 | + state_id='conclude') |
| 208 | + ChangeStateGroupEvent.objects.create(group=g,time=event_time,by=system,desc='Concluded group',state_id='conclude') |
| 209 | + g.role_set.create(name_id='chair',person=persons['Paul-Andre Pays'],email=persons['Paul-Andre Pays'].email_set.first()) |
| 210 | + g.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 211 | + g = Group.objects.create(name='Network Operations', |
| 212 | + acronym='wg-nop', |
| 213 | + time=create_time, |
| 214 | + parent=adm, |
| 215 | + type_id='wg', |
| 216 | + state_id='conclude') |
| 217 | + ChangeStateGroupEvent.objects.create(group=g,time=event_time,by=system,desc='Concluded group',state_id='conclude') |
| 218 | + g.role_set.create(name_id='chair',person=persons['Bernhard Stockman'],email=persons['Bernhard Stockman'].email_set.first()) |
| 219 | + g.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 220 | + g = Group.objects.create(name='Security Technology', |
| 221 | + acronym='wg-sec', |
| 222 | + time=create_time, |
| 223 | + parent=adm, |
| 224 | + type_id='wg', |
| 225 | + state_id='conclude') |
| 226 | + ChangeStateGroupEvent.objects.create(group=g,time=event_time,by=system,desc='Concluded group',state_id='conclude') |
| 227 | + g.role_set.create(name_id='chair',person=persons['Dr. Klaus Truoel'],email=persons['Dr. Klaus Truoel'].email_set.first()) |
| 228 | + g.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 229 | + g = Group.objects.create(name='Message Handeling Systems', |
| 230 | + acronym='wg1', |
| 231 | + time=create_time, |
| 232 | + parent=adm, |
| 233 | + type_id='wg', |
| 234 | + state_id='conclude') |
| 235 | + ChangeStateGroupEvent.objects.create(group=g,time=event_time,by=system,desc='Concluded group',state_id='conclude') |
| 236 | + g.role_set.create(name_id='chair',person=persons['Urs Eppenberger'],email=persons['Urs Eppenberger'].email_set.first()) |
| 237 | + g.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 238 | + g = Group.objects.create(name='File Transfer, Access and Management', |
| 239 | + acronym='wg2', |
| 240 | + time=create_time, |
| 241 | + parent=adm, |
| 242 | + type_id='wg', |
| 243 | + state_id='conclude') |
| 244 | + ChangeStateGroupEvent.objects.create(group=g,time=event_time,by=system,desc='Concluded group',state_id='conclude') |
| 245 | + g.role_set.create(name_id='chair',person=persons['Jean-Paul Le Guigner'],email=persons['Jean-Paul Le Guigner'].email_set.first()) |
| 246 | + g.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 247 | + g = Group.objects.create(name='Network Operations and X.25', |
| 248 | + acronym='wg4', |
| 249 | + time=create_time, |
| 250 | + parent=adm, |
| 251 | + type_id='wg', |
| 252 | + state_id='conclude') |
| 253 | + ChangeStateGroupEvent.objects.create(group=g,time=event_time,by=system,desc='Concluded group',state_id='conclude') |
| 254 | + g.role_set.create(name_id='chair',person=persons['Piet Bovenga'],email=persons['Piet Bovenga'].email_set.first()) |
| 255 | + g.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 256 | + g = Group.objects.create(name='Full Screen Services', |
| 257 | + acronym='wg5', |
| 258 | + time=create_time, |
| 259 | + parent=adm, |
| 260 | + type_id='wg', |
| 261 | + state_id='conclude') |
| 262 | + ChangeStateGroupEvent.objects.create(group=g,time=event_time,by=system,desc='Concluded group',state_id='conclude') |
| 263 | + g.role_set.create(name_id='chair',person=persons['Brian Gilmore'],email=persons['Brian Gilmore'].email_set.first()) |
| 264 | + g.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 265 | + g = Group.objects.create(name='Management of Network Application Services', |
| 266 | + acronym='wg8', |
| 267 | + time=create_time, |
| 268 | + parent=adm, |
| 269 | + type_id='wg', |
| 270 | + state_id='conclude') |
| 271 | + ChangeStateGroupEvent.objects.create(group=g,time=event_time,by=system,desc='Concluded group',state_id='conclude') |
| 272 | + g.role_set.create(name_id='chair',person=persons['Christian Tschudin'],email=persons['Christian Tschudin'].email_set.first()) |
| 273 | + g.role_set.create(name_id='ad',person=persons['Stephen J. Coya'],email=persons['Stephen J. Coya'].email_set.first()) |
| 274 | + |
| 275 | + Document.objects.filter(name='draft-rescorla-sec-cons').update(group=adm) |
| 276 | + |
| 277 | +class Migration(migrations.Migration): |
| 278 | + |
| 279 | + dependencies = [ |
| 280 | + ('group', '0006_auto_20150718_0509'), |
| 281 | + ('doc', '0012_auto_20160207_0537'), |
| 282 | + ('person', '0005_deactivate_unknown_email'), |
| 283 | + ('community','0002_auto_20141222_1749'), |
| 284 | + ] |
| 285 | + |
| 286 | + operations = [ |
| 287 | + migrations.RunPython(forward, reverse) |
| 288 | + ] |
0 commit comments