0001-general-assume-require-SQL-configuration-67190.patch
wcs/middleware.py | ||
---|---|---|
19 | 19 |
import time |
20 | 20 |
import urllib.parse |
21 | 21 | |
22 |
from django.http import HttpResponseBadRequest, HttpResponseRedirect |
|
22 |
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseRedirect
|
|
23 | 23 |
from django.utils.deprecation import MiddlewareMixin |
24 | 24 |
from quixote import get_publisher |
25 | 25 |
from quixote.errors import RequestError |
... | ... | |
43 | 43 |
except ImmediateRedirectException as e: |
44 | 44 |
return HttpResponseRedirect(e.location) |
45 | 45 | |
46 |
if not pub.has_postgresql_config(): |
|
47 |
return HttpResponse('Missing database configuration', content_type='text/plain', status=503) |
|
48 | ||
46 | 49 |
pub._set_request(compat_request) |
47 | 50 |
try: |
48 | 51 |
pub.parse_request(compat_request) |
wcs/publisher.py | ||
---|---|---|
133 | 133 |
DeprecationsScanAfterJob().execute() |
134 | 134 | |
135 | 135 |
def is_using_postgresql(self): |
136 |
return bool(self.has_site_option('postgresql') and self.cfg.get('postgresql', {})) |
|
136 |
return True |
|
137 | ||
138 |
def has_postgresql_config(self): |
|
139 |
return bool(self.cfg.get('postgresql', {})) |
|
137 | 140 | |
138 | 141 |
def set_config(self, request=None, skip_sql=False): |
139 | 142 |
QommonPublisher.set_config(self, request=request) |
wcs/qommon/management/commands/cron.py | ||
---|---|---|
67 | 67 |
if verbosity > 1: |
68 | 68 |
print('cron ignored on %s because DISABLE_CRON_JOBS is set' % hostname) |
69 | 69 |
continue |
70 |
if not publisher.has_postgresql_config(): |
|
71 |
if verbosity > 1: |
|
72 |
print('cron ignored on %s because it has no PostgreSQL configuration' % hostname) |
|
73 |
continue |
|
70 | 74 |
if verbosity > 1: |
71 | 75 |
print('cron work on %s' % hostname) |
72 | 76 |
CronJob.log('start') |
wcs/qommon/management/commands/migrate.py | ||
---|---|---|
30 | 30 |
for tenant in Publisher.get_tenants(): |
31 | 31 |
pub = Publisher.create_publisher() |
32 | 32 |
pub.set_tenant(tenant) |
33 |
if pub.is_using_postgresql():
|
|
33 |
if pub.has_postgresql_config():
|
|
34 | 34 |
if verbosity: |
35 | 35 |
print('Running migrations for', tenant.hostname, flush=True) |
36 | 36 |
pub.migrate_sql() |
37 |
- |