From acbaec64c034b25bcfd373362ca91ab821b95be6 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Sat, 3 Oct 2020 02:44:24 +0300 Subject: [PATCH] build(python): Make default config py3 compatible (#692) --- sentry/sentry.conf.example.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sentry/sentry.conf.example.py b/sentry/sentry.conf.example.py index 9136045..9cd4922 100644 --- a/sentry/sentry.conf.example.py +++ b/sentry/sentry.conf.example.py @@ -12,25 +12,25 @@ def get_internal_network(): import socket import struct - iface = "eth0" + iface = b"eth0" sockfd = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - ifreq = struct.pack("16sH14s", iface, socket.AF_INET, b"\x00" * 14) + ifreq = struct.pack(b"16sH14s", iface, socket.AF_INET, b"\x00" * 14) try: ip = struct.unpack( - "!I", struct.unpack("16sH2x4s8x", fcntl.ioctl(sockfd, 0x8915, ifreq))[2] + b"!I", struct.unpack(b"16sH2x4s8x", fcntl.ioctl(sockfd, 0x8915, ifreq))[2] )[0] netmask = socket.ntohl( - struct.unpack("16sH2xI8x", fcntl.ioctl(sockfd, 0x891B, ifreq))[2] + struct.unpack(b"16sH2xI8x", fcntl.ioctl(sockfd, 0x891B, ifreq))[2] ) except IOError: return () - base = socket.inet_ntoa(struct.pack("!I", ip & netmask)) + base = socket.inet_ntoa(struct.pack(b"!I", ip & netmask)) netmask_bits = 32 - int(round(math.log(ctypes.c_uint32(~netmask).value + 1, 2), 1)) - return ("{0:s}/{1:d}".format(base, netmask_bits),) + return "{0:s}/{1:d}".format(base, netmask_bits) -INTERNAL_SYSTEM_IPS = get_internal_network() +INTERNAL_SYSTEM_IPS = (get_internal_network(),) DATABASES = {