Save datasync config with new keys, per RattailConfiguration

This commit is contained in:
Lance Edgar 2023-06-01 11:12:31 -05:00
parent b4816c6289
commit fd2b290fd0

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2022 Lance Edgar
# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
@ -24,13 +24,10 @@
DataSync Views
"""
from __future__ import unicode_literals, absolute_import
import json
import subprocess
import logging
import six
import sqlalchemy as sa
from rattail.db import model
@ -117,7 +114,7 @@ class DataSyncThreadView(MasterView):
watcher_data = []
consumer_data = []
now = app.localtime()
for key, profile in six.iteritems(profiles):
for key, profile in profiles.items():
watcher = profile.watcher
lastrun = self.datasync_handler.get_watcher_lastrun(
@ -258,7 +255,7 @@ class DataSyncThreadView(MasterView):
watch.append(pkey)
settings.extend([
{'name': 'rattail.datasync.{}.watcher'.format(pkey),
{'name': 'rattail.datasync.{}.watcher.spec'.format(pkey),
'value': profile['watcher_spec']},
{'name': 'rattail.datasync.{}.watcher.db'.format(pkey),
'value': profile['watcher_dbkey']},
@ -289,7 +286,7 @@ class DataSyncThreadView(MasterView):
if consumer['enabled']:
consumers.append(ckey)
settings.extend([
{'name': 'rattail.datasync.{}.consumer.{}'.format(pkey, ckey),
{'name': 'rattail.datasync.{}.consumer.spec.{}'.format(pkey, ckey),
'value': consumer['consumer_spec']},
{'name': 'rattail.datasync.{}.consumer.{}.db'.format(pkey, ckey),
'value': consumer['consumer_dbkey']},
@ -304,7 +301,7 @@ class DataSyncThreadView(MasterView):
])
settings.extend([
{'name': 'rattail.datasync.{}.consumers'.format(pkey),
{'name': 'rattail.datasync.{}.consumers.list'.format(pkey),
'value': ', '.join(consumers)},
])