From 88d0a93d7784b0a957fbc5e3a7438a6a6e07cd91 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 13 Aug 2023 11:45:49 +0200 Subject: [PATCH 1/2] Fix netdata install/upgrade --- wo/cli/plugins/stack_pref.py | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index 0f83ea9..f3bee5b 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -1160,26 +1160,29 @@ def post_pref(self, apt_packages, packages, upgrade=False): Log.wait(self, "Installing Netdata") WOShellExec.cmd_exec( self, "bash /var/lib/wo/tmp/kickstart.sh " - "--dont-wait --no-updates --static-only", + "--dont-wait --no-updates --stable-channel " + "--reinstall-even-if-unsafe", errormsg='', log=False) Log.valide(self, "Installing Netdata") - if os.path.isdir('/etc/netdata'): - wo_netdata = "/" - elif os.path.isdir('/opt/netdata'): - wo_netdata = "/opt/netdata/" + # disable mail notifications + if os.path.isdir('/usr/lib/netdata/conf.d/health_alarm_notify.conf'): + WOFileUtils.searchreplace( + self, "/usr/lib/netdata/conf.d/health_alarm_notify.conf", + 'SEND_EMAIL="YES"', + 'SEND_EMAIL="NO"') + + if os.path.isdir('/opt/netdata/etc/netdata/health_alarm_notify.conf'): + WOFileUtils.searchreplace( + self, "/opt/netdata/etc/netdata/health_alarm_notify.conf", + 'SEND_EMAIL="YES"', + 'SEND_EMAIL="NO"') + WOFileUtils.searchreplace( self, "{0}etc/netdata/orig/health_alarm_notify.conf" .format(wo_netdata), 'SEND_EMAIL="YES"', 'SEND_EMAIL="NO"') - # make changes persistant - WOFileUtils.copyfile( - self, "{0}etc/netdata/orig/" - "health_alarm_notify.conf" - .format(wo_netdata), - "{0}etc/netdata/health_alarm_notify.conf" - .format(wo_netdata)) # check if mysql credentials are available if WOShellExec.cmd_exec(self, "mysqladmin ping"): try: @@ -1202,11 +1205,6 @@ def post_pref(self, apt_packages, packages, upgrade=False): Log.debug(self, "{0}".format(e)) Log.info( self, "fail to setup mysql user for netdata") - WOFileUtils.chown(self, '{0}etc/netdata' - .format(wo_netdata), - 'netdata', - 'netdata', - recursive=True) WOService.restart_service(self, 'netdata') # WordOps Dashboard From 813eb392a9c81353efacc820540d3973dfd44f08 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 13 Aug 2023 11:59:20 +0200 Subject: [PATCH 2/2] Fix netdata --- wo/cli/plugins/stack_pref.py | 3 +-- wo/cli/plugins/stack_upgrade.py | 12 ++---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index f3bee5b..fca4b6b 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -1179,8 +1179,7 @@ def post_pref(self, apt_packages, packages, upgrade=False): 'SEND_EMAIL="NO"') WOFileUtils.searchreplace( - self, "{0}etc/netdata/orig/health_alarm_notify.conf" - .format(wo_netdata), + self, "{0}etc/netdata/orig/health_alarm_notify.conf", 'SEND_EMAIL="YES"', 'SEND_EMAIL="NO"') # check if mysql credentials are available diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index f02f7a2..004ba51 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -362,17 +362,9 @@ class WOStackUpgradeController(CementBaseController): WOShellExec.cmd_exec( self, "bash /var/lib/wo/tmp/kickstart.sh " - "--dont-wait --no-updates --stable-channel", + "--dont-wait --no-updates --stable-channel " + "--reinstall-even-if-unsafe", errormsg='', log=False) - if (os.path.exists('/opt/netdata') and - not os.path.exists( - '/opt/netdata/var/run/netdata/netdata.pid')): - WOShellExec.cmd_exec( - self, - 'bash /var/lib/wo/tmp/kickstart.sh ' - '--dont-wait --no-updates ' - '--stable-channel --reinstall-even-if-unsafe', - errormsg='', log=False) Log.valide(self, "Upgrading Netdata") if WOAptGet.is_selected(self, 'WordOps Dashboard', packages):