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 77a79407 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB

Add a migration to update certs for bayeswave user

parent f62f506b
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-12-11 18:27
from __future__ import unicode_literals
from django.db import migrations
ACCOUNT_NAME = 'bayeswave'
NEW_CERT = '/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/ Becsy/CN=UID:bence.becsy.robot'
def update_certs(apps, schema_editor):
User = apps.get_model('auth', 'User')
# Get user
user = User.objects.get(username=ACCOUNT_NAME)
# Create new certificate
# Delete old certificates
for subj in OLD_CERTS:
old_cert = user.x509cert_set.get(subject=subj)
def revert_certs(apps, schema_editor):
User = apps.get_model('auth', 'User')
X509Cert = apps.get_model('ligoauth', 'X509Cert')
# Delete new certificate
new_cert = X509Cert.objects.get(subject=NEW_CERT)
# Get user
user = User.objects.get(username=ACCOUNT_NAME)
# Create old certificates
for subj in OLD_CERTS:
class Migration(migrations.Migration):
dependencies = [
('ligoauth', '0015_delete_hinj_cert'),
operations = [
migrations.RunPython(update_certs, revert_certs),
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