Gitlab will migrate to a new storage backend starting 0300 UTC on 2020-04-04. We do not anticipate a maintenance window for this migration. Performance may be impacted over the weekend. Thanks for your patience.

Commit 543ed965 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB

Bugfix migration for creating geo-ext-trig account

parent 61995562
...@@ -4,6 +4,11 @@ from __future__ import unicode_literals ...@@ -4,6 +4,11 @@ from __future__ import unicode_literals
from django.db import migrations from django.db import migrations
# Previously, this was taken from settings.LVC_GROUP, but that value has
# changed. So we have to hard-code it for past migrations
LVC_GROUP = 'Communities:LSCVirgoLIGOGroupMembers'
OLD = { OLD = {
'username': 'gerrit.kuehn@LIGO.ORG', 'username': 'gerrit.kuehn@LIGO.ORG',
'cert': '/DC=org/DC=ligo/O=LIGO/OU=Services/CN=ext-alert/geo-ws4.geo.rt.aei.uni-hannover.de', 'cert': '/DC=org/DC=ligo/O=LIGO/OU=Services/CN=ext-alert/geo-ws4.geo.rt.aei.uni-hannover.de',
...@@ -21,6 +26,7 @@ NEW_CERT = '/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=geo-ws4.geo.rt.aei.uni-h ...@@ -21,6 +26,7 @@ NEW_CERT = '/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=geo-ws4.geo.rt.aei.uni-h
def add_account_and_update_certs(apps, schema_editor): def add_account_and_update_certs(apps, schema_editor):
RobotUser = apps.get_model('ligoauth', 'RobotUser') RobotUser = apps.get_model('ligoauth', 'RobotUser')
X509Cert = apps.get_model('ligoauth', 'X509Cert') X509Cert = apps.get_model('ligoauth', 'X509Cert')
Group = apps.get_model('auth', 'Group')
# Delete old_cert # Delete old_cert
old_cert = X509Cert.objects.filter(subject=OLD['cert']) old_cert = X509Cert.objects.filter(subject=OLD['cert'])
...@@ -34,6 +40,10 @@ def add_account_and_update_certs(apps, schema_editor): ...@@ -34,6 +40,10 @@ def add_account_and_update_certs(apps, schema_editor):
# Create new certificate # Create new certificate
user.x509cert_set.create(subject=NEW_CERT) user.x509cert_set.create(subject=NEW_CERT)
# Add user to internal group
group = Group.objects.get(name=LVC_GROUP)
group.user_set.add(user)
def remove_account_and_revert_certs(apps, schema_editor): def remove_account_and_revert_certs(apps, schema_editor):
User = apps.get_model('auth', 'User') User = apps.get_model('auth', 'User')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment