diff options
-rw-r--r-- | cloudinit/distros/rhel_util.py | 2 | ||||
-rw-r--r-- | tests/unittests/test_distros/test_resolv.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/cloudinit/distros/rhel_util.py b/cloudinit/distros/rhel_util.py index 84aad623..903d7793 100644 --- a/cloudinit/distros/rhel_util.py +++ b/cloudinit/distros/rhel_util.py @@ -86,4 +86,4 @@ def update_resolve_conf_file(fn, dns_servers, search_servers): r_conf.add_search_domain(s) except ValueError: util.logexc(LOG, "Failed at adding search domain %s", s) - util.write_file(fn, r_conf, 0o644) + util.write_file(fn, str(r_conf), 0o644) diff --git a/tests/unittests/test_distros/test_resolv.py b/tests/unittests/test_distros/test_resolv.py index faaf5b7f..9edeb6e7 100644 --- a/tests/unittests/test_distros/test_resolv.py +++ b/tests/unittests/test_distros/test_resolv.py @@ -1,6 +1,8 @@ from cloudinit.distros.parsers import resolv_conf +from cloudinit.distros import rhel_util import re +import tempfile from ..helpers import TestCase @@ -19,6 +21,10 @@ class TestResolvHelper(TestCase): rp_r = str(rp).strip() self.assertEquals(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.assertEquals(None, rp.local_domain) |