Update index.py

pull/181/head
midoks 3 years ago
parent 6e026f2998
commit 082f697706
  1. 35
      plugins/haproxy/index.py

@ -147,22 +147,7 @@ def initDreplace():
return file_bin return file_bin
def checkIndexSph(): def haOp(method):
content = mw.readFile(getConf())
rep = 'path\s*=\s*(.*)'
p = re.compile(rep)
tmp = p.findall(content)
for x in tmp:
if x.find('binlog') != -1:
continue
else:
p = x + '.sph'
if os.path.exists(p):
return False
return True
def sphOp(method):
file = initDreplace() file = initDreplace()
if not mw.isAppleSystem(): if not mw.isAppleSystem():
@ -178,27 +163,19 @@ def sphOp(method):
def start(): def start():
return sphOp('start') return haOp('start')
def stop(): def stop():
return sphOp('stop') return haOp('stop')
def restart(): def restart():
return sphOp('restart') return haOp('restart')
def reload(): def reload():
return sphOp('reload') return haOp('reload')
def rebuild():
file = initDreplace()
subprocess.Popen(file + ' rebuild &',
stdout=subprocess.PIPE, shell=True)
# data = mw.execShell(file + ' rebuild')
return 'ok'
def initdStatus(): def initdStatus():
@ -315,8 +292,6 @@ if __name__ == "__main__":
print(restart()) print(restart())
elif func == 'reload': elif func == 'reload':
print(reload()) print(reload())
elif func == 'rebuild':
print(rebuild())
elif func == 'initd_status': elif func == 'initd_status':
print(initdStatus()) print(initdStatus())
elif func == 'initd_install': elif func == 'initd_install':

Loading…
Cancel
Save