]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/dnsmasq: remove unused backup/replace_resolv() 69371/head
authorCasey Bodley <cbodley@redhat.com>
Tue, 9 Jun 2026 18:13:23 +0000 (14:13 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 22 Jun 2026 14:34:50 +0000 (10:34 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
qa/tasks/dnsmasq.py

index 13e44bbfe1f99cf4da85018832ab7033c2fc96a9..4e44c8aa74de0fa21ce383b8b9944db5671146b8 100644 (file)
@@ -3,7 +3,6 @@ Task for dnsmasq configuration
 """
 import contextlib
 import logging
-import re
 
 from teuthology import misc
 from teuthology.exceptions import ConfigError
@@ -31,40 +30,6 @@ def install_dnsmasq(remote):
         if existing is None:
             packaging.remove_package('dnsmasq', remote)
 
-@contextlib.contextmanager
-def backup_resolv(remote, path, table):
-    """
-    Store a backup of resolv.conf in the testdir and restore it after the task.
-    Reserve 'nameserver' values per remote name in lookup 'table' for future use.
-    """
-    resolv_conf = remote.sh(f"cat /etc/resolv.conf | tee {path}")
-    nameserver_re = re.compile(r'\s*nameserver\s+([^\s]*)')
-    for line in resolv_conf.split('\n'):
-        if m := nameserver_re.match(line):
-            table.setdefault(remote.name, {}).setdefault('nameserver', []).append(m[1])
-    try:
-        yield
-    finally:
-        # restore with 'cp' to avoid overwriting its security context
-        remote.run(args=['sudo', 'cp', path, '/etc/resolv.conf'])
-        remote.run(args=['rm', path])
-
-@contextlib.contextmanager
-def replace_resolv(remote, path, table):
-    """
-    Update resolv.conf to point the nameserver at localhost.
-    """
-    remote.write_file(path, "nameserver 127.0.0.1\n")
-    try:
-        # install it
-        if remote.os.package_type == "rpm":
-            # for centos ovh resolv.conf has immutable attribute set
-            remote.run(args=['sudo', 'chattr', '-i', '/etc/resolv.conf'], check_status=False)
-        remote.run(args=['sudo', 'cp', path, '/etc/resolv.conf'])
-        yield
-    finally:
-        remote.run(args=['rm', path])
-
 @contextlib.contextmanager
 def configure_dnsmasq(remote, path, cnames):
     """