summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2020-10-21 12:11:06 -0400
committerGitHub <noreply@github.com>2020-10-21 12:11:06 -0400
commit93cebe009d116230850c770227e9ead5c490c0d0 (patch)
tree8c9c0818ac73562637b6f76ac4a1efb06943d554
parent5f8a2bbc5f26c7abafbc9bd3d1b1b655ffdcc1ae (diff)
downloadvyos-cloud-init-93cebe009d116230850c770227e9ead5c490c0d0.tar.gz
vyos-cloud-init-93cebe009d116230850c770227e9ead5c490c0d0.zip
Drop vestigial update_resolve_conf_file function (#620)
update_resolve_conf_file is no longer used. The last reference to it was removed in c3680475f9c970, which was itself a "remove dead code" commit.
-rw-r--r--cloudinit/distros/rhel_util.py26
-rw-r--r--tests/unittests/test_distros/test_resolv.py6
2 files changed, 0 insertions, 32 deletions
diff --git a/cloudinit/distros/rhel_util.py b/cloudinit/distros/rhel_util.py
index 387a851f..d71394b4 100644
--- a/cloudinit/distros/rhel_util.py
+++ b/cloudinit/distros/rhel_util.py
@@ -8,7 +8,6 @@
#
# This file is part of cloud-init. See LICENSE file for license information.
-from cloudinit.distros.parsers.resolv_conf import ResolvConf
from cloudinit.distros.parsers.sys_conf import SysConf
from cloudinit import log as logging
@@ -50,29 +49,4 @@ def read_sysconfig_file(fn):
contents = []
return (exists, SysConf(contents))
-
-# Helper function to update RHEL/SUSE /etc/resolv.conf
-def update_resolve_conf_file(fn, dns_servers, search_servers):
- try:
- r_conf = ResolvConf(util.load_file(fn))
- r_conf.parse()
- except IOError:
- util.logexc(LOG, "Failed at parsing %s reverting to an empty "
- "instance", fn)
- r_conf = ResolvConf('')
- r_conf.parse()
- if dns_servers:
- for s in dns_servers:
- try:
- r_conf.add_nameserver(s)
- except ValueError:
- util.logexc(LOG, "Failed at adding nameserver %s", s)
- if search_servers:
- for s in search_servers:
- try:
- r_conf.add_search_domain(s)
- except ValueError:
- util.logexc(LOG, "Failed at adding search domain %s", s)
- util.write_file(fn, str(r_conf), 0o644)
-
# vi: ts=4 expandtab
diff --git a/tests/unittests/test_distros/test_resolv.py b/tests/unittests/test_distros/test_resolv.py
index 68ea0083..7d940750 100644
--- a/tests/unittests/test_distros/test_resolv.py
+++ b/tests/unittests/test_distros/test_resolv.py
@@ -1,12 +1,10 @@
# This file is part of cloud-init. See LICENSE file for license information.
from cloudinit.distros.parsers import resolv_conf
-from cloudinit.distros import rhel_util
from cloudinit.tests.helpers import TestCase
import re
-import tempfile
BASE_RESOLVE = '''
@@ -24,10 +22,6 @@ class TestResolvHelper(TestCase):
rp_r = str(rp).strip()
self.assertEqual(BASE_RESOLVE, rp_r)
- def test_write_works(self):
- with tempfile.NamedTemporaryFile() as fh:
- rhel_util.update_resolve_conf_file(fh.name, [], [])
-
def test_local_domain(self):
rp = resolv_conf.ResolvConf(BASE_RESOLVE)
self.assertIsNone(rp.local_domain)