Commit f62f506b authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB

Add migration to delete an X509 cert for hinj user

parent 2b3442ab
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-12-11 18:21
from __future__ import unicode_literals
from django.db import migrations
ACCOUNT_NAME = 'hinj'
CERT_SUBJECT = '/DC=org/DC=ligo/O=LIGO/OU=Services/CN=hinj/ldas-grid.ligo.caltech.edu'
def delete_cert(apps, schema_editor):
X509Cert = apps.get_model('ligoauth', 'X509Cert')
# Get cert and delete
cert = X509Cert.objects.get(subject=CERT_SUBJECT)
cert.delete()
def create_cert(apps, schema_editor):
User = apps.get_model('auth', 'User')
# Get user and create certificate
user = User.objects.get(username=ACCOUNT_NAME)
user.x509cert_set.create(subject=CERT_SUBJECT)
class Migration(migrations.Migration):
dependencies = [
('ligoauth', '0014_add_new_dashboard_cert'),
]
operations = [
migrations.RunPython(delete_cert, create_cert),
]
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