From d8330f2430adacb2e7f83320377eb8aecccaa683 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Tue, 30 Mar 2021 22:08:01 +0500 Subject: [PATCH] bug fix clustermanager --- plogical/ClusterManager.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plogical/ClusterManager.py b/plogical/ClusterManager.py index 44da71a0f..d2aecfd74 100644 --- a/plogical/ClusterManager.py +++ b/plogical/ClusterManager.py @@ -21,7 +21,6 @@ class ClusterManager: ## self.config = json.loads(open(ClusterManager.ClusterFile, 'r').read()) - def PostStatus(self): finalData = json.dumps(self.config) resp = requests.post(ClusterManager.LogURL, data=finalData, verify=False) @@ -36,6 +35,7 @@ class ClusterManager: def DetechFromCluster(self, type): try: + command = 'rm -rf %s' % (self.FetchMySQLConfigFile()) ProcessUtilities.normalExecutioner(command) @@ -70,8 +70,10 @@ class ClusterManager: command = 'systemctl stop mysql' ProcessUtilities.normalExecutioner(command) - if type == 'Child': + command = 'rm -rf %s' % (ClusterConfigPath) + ProcessUtilities.executioner(command) + if type == 'Child': writeToFile = open(ClusterPath, 'w') writeToFile.write(config['ClusterConfigFailover']) @@ -81,7 +83,6 @@ class ClusterManager: self.config['failoverServerMessage'] = 'Successfully attached to cluster. [200]' self.PostStatus() else: - writeToFile = open(ClusterPath, 'w') writeToFile.write(config['ClusterConfigMaster']) @@ -91,6 +92,11 @@ class ClusterManager: self.config['masterServerMessage'] = 'Successfully attached to cluster. [200]' self.PostStatus() + ### + + command = 'rm -rf %s' % (ClusterConfigPath) + ProcessUtilities.executioner(command) + except BaseException as msg: if type == 'Child': self.config['failoverServerMessage'] = 'Failed to attach, error %s [404].' % (str(msg))