mirror of
https://github.com/getsentry/self-hosted.git
synced 2025-12-08 19:46:14 +00:00
build(python): Make default config py3 compatible (#692)
This commit is contained in:
parent
e333dbd56a
commit
acbaec64c0
@ -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 = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user