diff --git a/networkapi/plugins/F5/monitor.py b/networkapi/plugins/F5/monitor.py index aab40a466..e2de1d196 100644 --- a/networkapi/plugins/F5/monitor.py +++ b/networkapi/plugins/F5/monitor.py @@ -67,6 +67,12 @@ def prepare_template(self, **kwargs): if not valid_regex(hr, rg): hr = 'GET ' + hr + # do escape when healthcheck has simple \r\n + rg = '((\\r\\n))' + if valid_regex(hr, rg): + log.debug('adding unicode-escape') + hr = hr.encode('unicode-escape') + # add HTTP/1.\\r\\n\\r\\n when plugin no receive in # healthcheck rg = 'HTTP\/1' @@ -81,12 +87,6 @@ def prepare_template(self, **kwargs): log.debug('adding \\r\\n\\r\\n') hr = hr + '\\r\\n\\r\\n' - # do escape when healthcheck has simple \r\n\r\n - rg = '(?:((\\r\\n)){1,2}?)$' - if valid_regex(hr, rg): - log.debug('adding unicode-escape') - hr = hr.encode('unicode-escape') - healthcheck_request = hr template_names.append(name)