misc: explicitely load cronjobs, only in cron command (#18534)
This commit is contained in:
parent
1cda7e65c1
commit
99db3d85a2
|
@ -417,7 +417,7 @@ def test_configure_postgresql():
|
|||
|
||||
cleanup()
|
||||
|
||||
pub = WcsPublisher.create_publisher(register_cron=False, register_tld_names=False)
|
||||
pub = WcsPublisher.create_publisher(register_tld_names=False)
|
||||
pub.app_dir = os.path.join(alt_tempdir, 'wcs.example.net')
|
||||
pub.cfg['postgresql'] = {
|
||||
'createdb-connection-params': {
|
||||
|
|
|
@ -35,7 +35,7 @@ class CmdBackup(Command):
|
|||
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
pub = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
|
||||
hostname = args[0]
|
||||
pub.app_dir = os.path.join(pub.app_dir, hostname)
|
||||
|
|
|
@ -89,7 +89,7 @@ class CmdCheckHobos(Command):
|
|||
self.config.set('extra', 'cmd_line_extra_%d' % i, extra)
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
pub = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
|
||||
global_app_dir = pub.app_dir
|
||||
base_url = args[0]
|
||||
|
|
|
@ -63,7 +63,7 @@ class CmdConvertToSql(Command):
|
|||
self.config.remove_option('main', 'error_log')
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
pub = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
|
||||
hostname = args[0]
|
||||
pub.app_dir = os.path.join(pub.app_dir, hostname)
|
||||
|
|
|
@ -38,7 +38,7 @@ class CmdDeleteTenant(Command):
|
|||
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
pub = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
|
||||
hostname = args[0]
|
||||
pub.app_dir = os.path.join(pub.app_dir, hostname)
|
||||
|
|
|
@ -32,7 +32,7 @@ class CmdExportSettings(Command):
|
|||
self.config.remove_option('main', 'error_log')
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
pub = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
pub.app_dir = os.path.join(pub.app_dir, sub_options.vhost)
|
||||
pub.reload_cfg()
|
||||
print pub.export_cfg()
|
||||
|
|
|
@ -43,7 +43,7 @@ class CmdHoboNotify(Command):
|
|||
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
pub = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
global_app_dir = pub.app_dir
|
||||
for hostname in publisher.WcsPublisher.get_tenants():
|
||||
app_dir = os.path.join(global_app_dir, hostname)
|
||||
|
|
|
@ -37,7 +37,7 @@ class CmdProcessBounce(Command):
|
|||
try:
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
pub = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
except:
|
||||
# not much we can do if we don't have a publisher object :/
|
||||
return
|
||||
|
|
|
@ -50,7 +50,7 @@ class CmdRebuildIndexes(Command):
|
|||
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
pub = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
|
||||
app_dir = pub.app_dir
|
||||
if sub_options.all:
|
||||
|
|
|
@ -36,7 +36,7 @@ class CmdRestore(Command):
|
|||
self.config.remove_option('main', 'error_log')
|
||||
publisher.WcsPublisher.configure(self.config, sub_options.extra)
|
||||
pub = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
|
||||
hostname = args[0]
|
||||
pub.app_dir = os.path.join(pub.app_dir, hostname)
|
||||
|
|
|
@ -36,7 +36,7 @@ class CmdRunScript(Command):
|
|||
self.config.remove_option('main', 'error_log')
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
publisher = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
publisher.app_dir = os.path.join(publisher.app_dir, sub_options.vhost)
|
||||
publisher.set_config()
|
||||
fullpath = os.path.dirname(os.path.abspath(args[0]))
|
||||
|
|
|
@ -37,7 +37,7 @@ class CmdShell(Command):
|
|||
self.config.remove_option('main', 'error_log')
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
publisher = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
publisher.app_dir = os.path.join(publisher.APP_DIR, args[0])
|
||||
if not os.path.exists(publisher.app_dir):
|
||||
print 'Application directory %r does not exist.' % publisher.app_dir
|
||||
|
|
|
@ -71,7 +71,7 @@ class CmdTriggerJumps(Command):
|
|||
self.config.remove_option('main', 'error_log')
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
publisher = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
publisher.app_dir = os.path.join(publisher.app_dir, sub_options.vhost)
|
||||
publisher.set_config()
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class CmdWipeData(Command):
|
|||
import publisher
|
||||
publisher.WcsPublisher.configure(self.config)
|
||||
pub = publisher.WcsPublisher.create_publisher(
|
||||
register_cron=False, register_tld_names=False)
|
||||
register_tld_names=False)
|
||||
pub.app_dir = os.path.join(pub.app_dir, sub_options.vhost)
|
||||
pub.set_config()
|
||||
self.wipe(pub, sub_options, args)
|
||||
|
|
|
@ -32,7 +32,7 @@ class Command(BaseCommand):
|
|||
with locket.lock_file(os.path.join(tempfile.gettempdir(), 'wcs-cron')):
|
||||
now = time.localtime()
|
||||
publisher_class = get_publisher_class()
|
||||
publisher_class.register_cron = True
|
||||
publisher_class.register_cronjobs()
|
||||
publisher = publisher_class.create_publisher()
|
||||
app_dir = publisher.app_dir
|
||||
for hostname in publisher.get_tenants():
|
||||
|
|
|
@ -740,7 +740,6 @@ class QommonPublisher(Publisher, object):
|
|||
cls.register_cronjob(CronJob(cls.clean_afterjobs, minutes=[random.randint(0, 59)]))
|
||||
cls.register_cronjob(CronJob(cls.clean_tempfiles, minutes=[random.randint(0, 59)]))
|
||||
|
||||
register_cron = False
|
||||
register_tld_names = False
|
||||
|
||||
_initialized = False
|
||||
|
@ -750,8 +749,6 @@ class QommonPublisher(Publisher, object):
|
|||
return
|
||||
cls._initialized = True
|
||||
cls.load_extra_dirs()
|
||||
if cls.register_cron:
|
||||
cls.register_cronjobs()
|
||||
|
||||
if cls.register_tld_names:
|
||||
cls.load_effective_tld_names()
|
||||
|
|
Loading…
Reference in New Issue