Skip to content

Commit

Permalink
Only restart service when config actually changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilman Baumann committed Aug 30, 2017
1 parent a193846 commit 6f48e5c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions reactive/filebeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from charms.reactive import remove_state

from charmhelpers.core.hookenv import status_set
from charmhelpers.core.host import service_restart
from charmhelpers.core.host import restart_on_change

from elasticbeats import render_without_context
from elasticbeats import enable_beat_on_boot
Expand All @@ -19,11 +19,12 @@ def install_filebeat():
charms.apt.queue_install(['filebeat'])


@restart_on_change('/etc/filebeat/filebeat.yml', ['filebeat'])
@when('beat.render')
@when('apt.installed.filebeat')
def render_filebeat_template():
connections = render_without_context('filebeat.yml', '/etc/filebeat/filebeat.yml')
remove_state('beat.render')
service_restart('filebeat')
if connections:
status_set('active', 'Filebeat ready.')

Expand Down

0 comments on commit 6f48e5c

Please sign in to comment.