From 7dcd90cff667763ddc402b92d0107132eb594aae Mon Sep 17 00:00:00 2001 From: Julian Labus Date: Wed, 7 Nov 2018 15:20:40 +0100 Subject: [PATCH] Role service-bird-lg: remove obsolete patching --- .../files/simplify-parsing.patch | 59 ------------------- roles/service-bird-lg/tasks/lg-webservice.yml | 6 -- 2 files changed, 65 deletions(-) delete mode 100644 roles/service-bird-lg/files/simplify-parsing.patch diff --git a/roles/service-bird-lg/files/simplify-parsing.patch b/roles/service-bird-lg/files/simplify-parsing.patch deleted file mode 100644 index cf726a4..0000000 --- a/roles/service-bird-lg/files/simplify-parsing.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0e45d90b7044225125ef92568deb4305f815224f Mon Sep 17 00:00:00 2001 -From: Baptiste Jonglez -Date: Wed, 12 Feb 2014 15:47:27 +0100 -Subject: [PATCH] Simplify parsing of 'show protocols' to avoid future - breakages - -The current parsing method (ugly regexp) is hard to understand and prone -to breakage: - -- Bird 1.4 changed the date format, which broke the parser () -- Bird 2.0 changed the format of the "Table" field, which again broke the parser (#36) - -The new method is much simpler, does not involve any regexp, and should -thus resist small syntax changes in Bird's output. - -Important limitation: parsing will be messed up if the date contains a -space character. There is no space in the default date format of Bird -(checked with Bird 1.3 to Bird 2.0), but since the date format is -configurable in Bird, it may happen anyway. In particular, setting -"timeformat protocol iso long" in Bird will break bird-lg's parser. - -Fixes #36 ---- - lg.py | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - -diff --git a/lg.py b/lg.py -index b4bdd8b..6a9f4e7 100644 ---- a/lg.py -+++ b/lg.py -@@ -223,8 +223,6 @@ def whois(): - - - SUMMARY_UNWANTED_PROTOS = ["Kernel", "Static", "Device"] --SUMMARY_RE_MATCH = r"(?P[\w_]+)\s+(?P\w+)\s+(?P\w+)\s+(?P\w+)\s+(?P((|\d\d\d\d-\d\d-\d\d\s)|(\d\d:)\d\d:\d\d|\w\w\w\d\d))($|\s+(?P.*))" -- - - @app.route("/summary/") - @app.route("/summary//") -@@ -251,9 +249,16 @@ def summary(hosts, proto="ipv4"): - for line in res[1:]: - line = line.strip() - if line and (line.split() + [""])[1] not in SUMMARY_UNWANTED_PROTOS: -- m = re.match(SUMMARY_RE_MATCH, line) -- if m: -- data.append(m.groupdict()) -+ split = line.split() -+ if len(split) >= 5: -+ props = dict() -+ props["name"] = split[0] -+ props["proto"] = split[1] -+ props["table"] = split[2] -+ props["state"] = split[3] -+ props["since"] = split[4] -+ props["info"] = ' '.join(split[5:]) if len(split) > 5 else "" -+ data.append(props) - else: - app.logger.warning("couldn't parse: %s", line) - diff --git a/roles/service-bird-lg/tasks/lg-webservice.yml b/roles/service-bird-lg/tasks/lg-webservice.yml index 58dba94..c86e11a 100644 --- a/roles/service-bird-lg/tasks/lg-webservice.yml +++ b/roles/service-bird-lg/tasks/lg-webservice.yml @@ -7,12 +7,6 @@ notify: - restart bird-lg-webservice -- name: apply patch simplify-parsing - patch: - src: simplify-parsing.patch - basedir: "{{ lg_path }}" - strip: 1 - - name: write vhost lookingglass.conf template: src: lookingglass_vhost.conf.j2