nagios-charmers team mailing list archive
-
nagios-charmers team
-
Mailing list archive
-
Message #01151
[Merge] ~xavpaice/charm-nagios:bug/1819537 into charm-nagios:master
Xav Paice has proposed merging ~xavpaice/charm-nagios:bug/1819537 into charm-nagios:master.
Requested reviews:
Nagios Charm developers (nagios-charmers)
Related bugs:
Bug #1819537 in Nagios Charm: "config-changed hook fails with enable_livestatus enabled"
https://bugs.launchpad.net/charm-nagios/+bug/1819537
For more details, see:
https://code.launchpad.net/~xavpaice/charm-nagios/+git/nagios-charm/+merge/391663
--
Your team Nagios Charm developers is requested to review the proposed merge of ~xavpaice/charm-nagios:bug/1819537 into charm-nagios:master.
diff --git a/hooks/upgrade_charm.py b/hooks/upgrade_charm.py
index 4152e53..82bfbba 100755
--- a/hooks/upgrade_charm.py
+++ b/hooks/upgrade_charm.py
@@ -12,6 +12,7 @@ import shutil
import stat
import string
import subprocess
+import time
try:
from enum import Enum # noqa: F401
@@ -172,18 +173,21 @@ def fixpath(path):
def enable_livestatus_config():
if enable_livestatus:
- hookenv.log("Livestatus is enabled")
- fetch.apt_update()
- fetch.apt_install("check-mk-livestatus")
-
- # Make the directory and fix perms on it
- hookenv.log("Fixing perms on livestatus_path")
livestatus_dir = os.path.dirname(livestatus_path)
-
+ hookenv.log("Livestatus is enabled")
if not os.path.isdir(livestatus_dir):
hookenv.log("Making path for livestatus_dir")
mkdir_p(livestatus_dir)
+ # fix perms on livestatus dir
+ hookenv.log("Fixing perms on livestatus_path")
fixpath(livestatus_dir)
+ fetch.apt_update()
+ fetch.apt_install("check-mk-livestatus")
+ # Wait for livestatus to actually make the socket
+ wait_time = 0
+ while (not os.path.exists(livestatus_path)) and wait_time < 60:
+ wait_time += 5
+ time.sleep(5)
# Fix the perms on the socket
hookenv.log("Fixing perms on the socket")