pagekite: restart service when config is changed

so the changed config gets applied immediately, and
not only after enabling/disabling the service manually.
This commit is contained in:
fonfon committed 2015-05-03 16:53:47 +02:00
1 parent ef08f40447
commit 7a4486fadf
2 files changed
+15

No files matched your search

+8
View File
@@ -70,15 +70,18 @@ for your account if no secret is set on the kite'))
if old != new:
config_changed = False
if old['kite_name'] != new['kite_name'] or \
old['kite_secret'] != new['kite_secret']:
_run(['set-kite', '--kite-name', new['kite_name'],
'--kite-secret', new['kite_secret']])
messages.success(request, _('Kite details set'))
config_changed = True
if old['server'] != new['server']:
_run(['set-frontend', new['server']])
messages.success(request, _('Pagekite server set'))
config_changed = True
if old['enabled'] != new['enabled']:
if new['enabled']:
@@ -88,6 +91,11 @@ for your account if no secret is set on the kite'))
_run(['stop-and-disable'])
messages.success(request, _('PageKite disabled'))
# Restart the service if the config was changed while the service
# was running, so the changes take effect.
elif config_changed and new['enabled']:
_run(['restart'])
class DefaultServiceForm(forms.Form):
"""Creates a form out of PREDEFINED_SERVICES"""