Ema has submitted this change and it was merged.

Change subject: varnishlog.py: remove trailing NULL byte only if present
......................................................................


varnishlog.py: remove trailing NULL byte only if present

Instead of unconditionally removing the last element of the data string
returned by varnishapi.VarnishLog.Dispatch we should only remove NULL
bytes. Newer versions of python-varnishapi do not return a trailing NULL
byte, resulting in very broken varnishlog behavior (eg: GET -> GE).

Change-Id: I4de0f6a9b75db8dd395d810d39ab43e59e8233bf
---
M modules/varnish/files/varnishlog4.py
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Ema: Verified; Looks good to me, approved
  Volans: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/modules/varnish/files/varnishlog4.py 
b/modules/varnish/files/varnishlog4.py
index 68742c7..0ef53fa 100755
--- a/modules/varnish/files/varnishlog4.py
+++ b/modules/varnish/files/varnishlog4.py
@@ -129,8 +129,8 @@
         transaction_id = cbd['vxid']
         tag = vap.VSL_tags[cbd['tag']]
 
-        # Remove trailing NULL byte
-        value = cbd['data'][:-1]
+        # Remove trailing NULL byte (if any)
+        value = cbd['data'].rstrip(b'\x00')
 
         remote_type = cbd['type']
 

-- 
To view, visit https://gerrit.wikimedia.org/r/318514
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4de0f6a9b75db8dd395d810d39ab43e59e8233bf
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ema <e...@wikimedia.org>
Gerrit-Reviewer: BBlack <bbl...@wikimedia.org>
Gerrit-Reviewer: Elukey <ltosc...@wikimedia.org>
Gerrit-Reviewer: Ema <e...@wikimedia.org>
Gerrit-Reviewer: Volans <rcocci...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to