Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
f65c5b9c
Commit
f65c5b9c
authored
Jan 22, 2016
by
jsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure reverse migration to delete a specific row won’t fail.
parent
d2eaa633
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
openedx/core/djangoapps/credentials/migrations/0002_data__add_service_user.py
+8
-3
No files found.
openedx/core/djangoapps/credentials/migrations/0002_data__add_service_user.py
View file @
f65c5b9c
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
import
logging
from
django.db
import
migrations
,
models
from
django.db
import
migrations
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
logger
=
logging
.
getLogger
(
__name__
)
def
add_service_user
(
apps
,
schema_editor
):
"""Add service user."""
user
,
created
=
User
.
objects
.
get_or_create
(
username
=
settings
.
CREDENTIALS_SERVICE_USERNAME
)
...
...
@@ -20,8 +24,9 @@ def remove_service_user(apps, schema_editor):
"""Remove service user."""
try
:
User
.
objects
.
get
(
username
=
settings
.
CREDENTIALS_SERVICE_USERNAME
)
.
delete
()
except
User
.
DoesNotExist
:
return
except
Exception
:
# pylint: disable=broad-except
logger
.
exception
(
'Unexpected error while attempting to delete credentials service user.'
)
logger
.
warning
(
'This service user account may need cleanup, but migrations can safely continue.'
)
class
Migration
(
migrations
.
Migration
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment