New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor settings checks using django.core.checks #1121
Conversation
Attached issue: https://pulp.plan.io/issues/8077 |
62b6b40
to
5cd1fad
Compare
# the E003 check will handle this problem. skip to prevent FieldError. | ||
continue | ||
|
||
if Artifact.objects.filter(**{checksum: None}).exists(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the logs, it seems it is executed before the migrations, so it breaks because core_artifact
is not on the database yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read, that this is taken care of in line 120.
9ab7dc6
to
df4a498
Compare
df4a498
to
8974b8d
Compare
@@ -270,76 +262,3 @@ | |||
ENVVAR_FOR_DYNACONF="PULP_SETTINGS", | |||
) | |||
# HERE ENDS DYNACONF EXTENSION LOAD (No more code below this line) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! Now it makes sence!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an expert on django checks, but this looks reasonable.
When I run
|
I can't remember what our motivation was to move these to be django.checks. I know that is probably a better mechanism, but also we've had problems using them for our assertions. Whenever I've tried to make a django.check I couldn't be sure it was running at startup for example. |
Ah, I tried to use the
It's definitely a better mechanism. It's more in line with what django recommends and it keeps business logic out of the settings file where it doesn't belong. I'd be interested in knowing more about the problems you had. For one thing, the storage checks currently in the file are deployment checks so they don't run automatically. |
Agreed on all that; I just couldn't get it working when I did it (see below).
It's been a few weeks, but iirc, even when I had a check that should fail in place, when I started each component, the processes still started without failure. I'll test this when you push yours next and if it indeed fails, then I think we're good to go. |
fixes #8077
Please be sure you have read our documentation on creating PRs:
https://docs.pulpproject.org/contributing/pull-request-walkthrough.html