]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/zabbix: fix invalid escape sequence
authorKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Tue, 23 Jul 2024 18:17:13 +0000 (20:17 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Tue, 23 Jul 2024 18:17:13 +0000 (20:17 +0200)
Get rid of DepricationWarning which, according to [1],
is going to become a SyntaxError:

  /home/jenkins-build/build/workspace/ceph-pull-requests/src/pybind/mgr/zabbix/module.py:134: DeprecationWarning: invalid escape sequence '\['
    uri = re.match("(?:(?:\[?)([a-z0-9-\.]+|[a-f0-9:\.]+)(?:\]?))(?:((?::))([0-9]{1,5}))?$", server)

1. https://docs.python.org/3.11/library/re.html

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@clyso.com>
src/pybind/mgr/zabbix/module.py

index 638b688562f2f417526d9fc44bb6aae339382d83..2e348ab03916d21ea49f755ee65f463163376f22 100644 (file)
@@ -131,7 +131,7 @@ class Module(MgrModule):
         self._zabbix_hosts = list()
         servers = cast(str, self.config['zabbix_host']).split(",")
         for server in servers:
-            uri = re.match("(?:(?:\[?)([a-z0-9-\.]+|[a-f0-9:\.]+)(?:\]?))(?:((?::))([0-9]{1,5}))?$", server)
+            uri = re.match(r"(?:(?:\[?)([a-z0-9-\.]+|[a-f0-9:\.]+)(?:\]?))(?:((?::))([0-9]{1,5}))?$", server)
             if uri:
                 zabbix_host, sep, opt_zabbix_port = uri.groups()
                 if sep == ':':