From: Ismaƫl Bouya Date: Sun, 13 May 2018 13:41:16 +0000 (+0200) Subject: wait for journal rather than polling X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FPuppet.git;a=commitdiff_plain;h=a859ab30660104d25485824afa1c23de454bb5ed wait for journal rather than polling --- diff --git a/modules/role/manifests/cryptoportfolio/front.pp b/modules/role/manifests/cryptoportfolio/front.pp index 3612fd5..aa57f4e 100644 --- a/modules/role/manifests/cryptoportfolio/front.pp +++ b/modules/role/manifests/cryptoportfolio/front.pp @@ -151,6 +151,7 @@ class role::cryptoportfolio::front inherits role::cryptoportfolio { file { "/usr/local/bin/api_logger": mode => "0755", content => template("role/cryptoportfolio/api_logger.py.erb"), + notify => Service["cryptoportfolio-log"], } -> file { "/etc/systemd/system/cryptoportfolio-log.service": @@ -158,7 +159,10 @@ class role::cryptoportfolio::front inherits role::cryptoportfolio { owner => "root", group => "root", content => template("role/cryptoportfolio/cryptoportfolio-log.service.erb"), - notify => Exec["systemctl daemon-reload"], + notify => [ + Exec["systemctl daemon-reload"], + Service["cryptoportfolio-log"] + ] } -> service { 'cryptoportfolio-log': diff --git a/modules/role/templates/cryptoportfolio/api_logger.py.erb b/modules/role/templates/cryptoportfolio/api_logger.py.erb index 3fb14a0..ad296e8 100644 --- a/modules/role/templates/cryptoportfolio/api_logger.py.erb +++ b/modules/role/templates/cryptoportfolio/api_logger.py.erb @@ -50,4 +50,4 @@ while True: lines = [entry["MESSAGE"] for entry in list(j)] if len(lines) > 0: send_to_discord("\n".join(lines)) - time.sleep(3) + j.wait()