From 54f5b44e04680d85f30fa794041057fc76e4dfb9 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sun, 1 Dec 2024 22:16:30 +0800 Subject: [PATCH] Update index.py --- plugins/rsyncd/index.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/rsyncd/index.py b/plugins/rsyncd/index.py index 778e4da14..78b85d451 100755 --- a/plugins/rsyncd/index.py +++ b/plugins/rsyncd/index.py @@ -119,9 +119,10 @@ def getLsyncdLog(): def __release_port(port): + from collections import namedtuple try: - import firewall_api - firewall_api.firewall_api().addAcceptPortArgs(port, 'RSYNC同步', 'port') + from utils.firewall import Firewall as MwFirewall + MwFirewall.instance().addAcceptPort(port, 'RSYNC同步', 'port') return port except Exception as e: return "Release failed {}".format(e) @@ -461,13 +462,12 @@ def delRecBy(name): next_name = reclist[x + 1]['name'] reg = '' if is_end: - reg = '\\[' + name + '\\]\\s*(.*)' + reg = r'\[' + name + r'\]\s*(.*)' else: - reg = '\\[' + name + '\\]\\s*(.*)\\s*\\[' + next_name + '\\]' + reg = r'\\[' + name + r'\]\s*(.*)\s*\[' + next_name + r'\]' conre = re.search(reg, content, re.S) - content = content.replace( - "[" + name + "]\n" + conre.groups()[0], '') + content = content.replace("[" + name + "]\n" + conre.groups()[0], '') mw.writeFile(path, content) except Exception as e: return False