Properly revert Netdata changes

This commit is contained in:
VirtuBox
2019-07-11 18:39:32 +02:00
parent 724fc0f5d6
commit ac285d8829

View File

@@ -1170,6 +1170,40 @@ class WOStackController(CementBaseController):
"update -n --no-dev -d "
"/var/www/22222/htdocs/db/pma/")
# netdata install
if any('/var/lib/wo/tmp/kickstart.sh' == x[1]
for x in packages):
if ((not os.path.exists('/opt/netdata')) and
(not os.path.exists('/etc/netdata'))):
Log.info(self, "Installing Netdata, please wait...")
WOShellExec.cmd_exec(self, "bash /var/lib/wo/tmp/"
"kickstart.sh "
"--dont-wait")
# disable mail notifications
WOFileUtils.searchreplace(self, "/opt/netdata/usr/"
"lib/netdata/conf.d/"
"health_alarm_notify.conf",
'SEND_EMAIL="YES"',
'SEND_EMAIL="NO"')
# check if mysql credentials are available
if os.path.isfile('/etc/mysql/conf.d/my.cnf'):
try:
WOMysql.execute(self,
"create user "
"'netdata'@'localhost';",
log=False)
WOMysql.execute(self,
"grant usage on *.* to "
"'netdata'@'localhost';",
log=False)
WOMysql.execute(self,
"flush privileges;",
log=False)
except CommandExecutionError as e:
Log.info(
self, "fail to setup mysql user for netdata")
WOService.restart_service(self, 'netdata')
# WordOps Dashboard
if any('/var/lib/wo/tmp/wo-dashboard.tar.gz' == x[1]
for x in packages):
@@ -1695,43 +1729,6 @@ class WOStackController(CementBaseController):
"allkeys-lru/' "
"/etc/redis/redis.conf")
WOService.restart_service(self, 'redis-server')
if 'Netdata' in packages:
if ((not os.path.exists('/opt/netdata')) and
(not os.path.exists('/etc/netdata'))):
if os.path.isfile("/var/lib/wo/tmp/kickstart.sh"):
Log.info(self, "Installing Netdata, please wait...")
WOShellExec.cmd_exec(self, "bash /var/lib/wo/tmp/"
"kickstart.sh "
"--dont-wait")
# disable mail notifications
WOFileUtils.searchreplace(self, "/opt/netdata/usr/"
"lib/netdata/conf.d/"
"health_alarm_notify.conf",
'SEND_EMAIL="YES"',
'SEND_EMAIL="NO"')
# check if mysql credentials are available
if os.path.isfile('/etc/mysql/conf.d/my.cnf'):
try:
WOMysql.execute(self,
"create user "
"'netdata'@'localhost';",
log=False)
WOMysql.execute(self,
"grant usage on *.* to "
"'netdata'@'localhost';",
log=False)
WOMysql.execute(self,
"flush privileges;",
log=False)
except CommandExecutionError as e:
Log.info(
self, "fail to setup mysql user "
"for netdata")
WOService.restart_service(self, 'netdata')
if disp_msg:
if (self.msg):
for msg in self.msg: