Skip to content

Commit

Permalink
topotato: kill scapy nameserver warning
Browse files Browse the repository at this point in the history
topotato doesn't want scapy to use any nameservers.  Monkey patch
scapy's `read_nameservers` and make it not print a confusing warning.

Signed-off-by: David Lamparter <[email protected]>
  • Loading branch information
eqvinox committed Oct 1, 2024
1 parent f4d21af commit ef186b1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions topotato/topolinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,18 @@

import pytest

import scapy.all # type: ignore
import scapy.config # type: ignore
import scapy.arch # type: ignore[import-untyped]

# this is here for 2 reasons (and needs to be before "import scapy.all":
# - topotato neither needs nor wants scapy to use any nameservers, the list
# *should* be empty
# - scapy prints a confusing message if it can't read resolv.conf
# ("Could not retrieve the OS's nameserver !")
scapy.arch.read_nameservers = lambda: []

# pylint: disable=wrong-import-position
import scapy.all # type: ignore[import-untyped]
import scapy.config # type: ignore[import-untyped]

from .defer import subprocess
from .utils import exec_find, EnvcheckResult
Expand Down

0 comments on commit ef186b1

Please sign in to comment.