Skip to content
Snippets Groups Projects
Commit 306de203 authored by Alexander Pace's avatar Alexander Pace
Browse files

Three new migrations

New certificates for nagios, gstlalcbc, and detchar
parent b6a9baeb
No related branches found
No related tags found
1 merge request!29Python3
Pipeline #88738 failed
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-03 20:10
from __future__ import unicode_literals
from django.db import migrations
# Note: the CN in the cert is for detchar-la, not detchar.
ACCOUNT = {
'name': 'nagios',
'new_cert': '/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=dashboard.ligo.org/CN=NagiosShibScraper/CN=Shawn Kwang/CN=UID:shawn.kwang.robot',
}
def add_cert(apps, schema_editor):
RobotUser = apps.get_model('auth', 'User')
# Get user
user = RobotUser.objects.get(username=ACCOUNT['name'])
# Create new certificate
user.x509cert_set.create(subject=ACCOUNT['new_cert'])
def delete_cert(apps, schema_editor):
RobotUser = apps.get_model('auth', 'User')
# Get user
user = RobotUser.objects.get(username=ACCOUNT['name'])
# Delete new certificate
cert = user.x509cert_set.get(subject=ACCOUNT['new_cert'])
cert.delete()
class Migration(migrations.Migration):
dependencies = [
('ligoauth', '0055_update_detchar_cert'),
]
operations = [
migrations.RunPython(add_cert, delete_cert),
]
ngo 1.11.20 on 2019-06-03 20:10
from __future__ import unicode_literals
from django.db import migrations
# Note: the CN in the cert is for detchar-la, not detchar.
ACCOUNT = {
'name': 'gstlalcbc',
'new_cert': '/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=submit.nemo.uwm.edu/CN=gstlal_online_luigi/CN=Duncan Meacher/CN=UID:duncan.meacher.robot',
}
def add_cert(apps, schema_editor):
RobotUser = apps.get_model('auth', 'User')
# Get user
user = RobotUser.objects.get(username=ACCOUNT['name'])
# Create new certificate
user.x509cert_set.create(subject=ACCOUNT['new_cert'])
def delete_cert(apps, schema_editor):
RobotUser = apps.get_model('auth', 'User')
# Get user
user = RobotUser.objects.get(username=ACCOUNT['name'])
# Delete new certificate
cert = user.x509cert_set.get(subject=ACCOUNT['new_cert'])
cert.delete()
class Migration(migrations.Migration):
dependencies = [
('ligoauth', '0056_update_dashboard_cert'),
]
operations = [
migrations.RunPython(add_cert, delete_cert),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-03 20:10
from __future__ import unicode_literals
from django.db import migrations
# detchar is on a tear getting new certs, so I'm doing three
# at once.
gracedb_account = 'detchar'
new_certs = ['/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=detchar.ligo-wa.caltech.edu/CN=detchar_ligo-wa/CN=Alexander Urban/CN=UID:alexander.urban.robot',
'/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=detchar.ligo.caltech.edu/CN=detchar_cit/CN=Alexander Urban/CN=UID:alexander.urban.robot',
'/DC=org/DC=cilogon/C=US/O=LIGO/OU=Robots/CN=ldas-pcdev1.ligo-la.caltech.edu/CN=detchar_ldas-pcdev1_ligo-la/CN=Michael Thomas/CN=UID:michael.thomas.robot']
def add_cert(apps, schema_editor):
RobotUser = apps.get_model('auth', 'User')
# Get user
user = RobotUser.objects.get(username=gracedb_account)
# Create new certificates
for cert in new_certs:
user.x509cert_set.create(subject=cert)
def delete_cert(apps, schema_editor):
RobotUser = apps.get_model('auth', 'User')
# Get user
user = RobotUser.objects.get(username=gracedb_account)
# Delete new certificates
for cert in new_certs:
cert = user.x509cert_set.get(subject=cert)
cert.delete()
class Migration(migrations.Migration):
dependencies = [
('ligoauth', '0057_gstlalcbc_luigi_cert'),
]
operations = [
migrations.RunPython(add_cert, delete_cert),
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment