Commit 822ac18b authored by Scott Moser's avatar Scott Moser

Ensure that a resolve conf object is written as a string.

Instead of passing the raw object and expecting the write_file to work
automatically make sure we explicitly pass the string version of it so
that the write_file routine can correctly encode/decode it as needed.

LP: #1479988
parents d75a912f 2fd22530
......@@ -102,6 +102,7 @@
- disk_setup: correctly send --force to mkfs on block devices (LP: #1548772)
- chef: fix chef install from gems (LP: #1553345)
- systemd: do not specify After of obsolete (LP: #1536964)
- centos: Ensure that resolve conf object is written as a str (LP: #1479988)
- open 0.7.6
......@@ -86,4 +86,4 @@ def update_resolve_conf_file(fn, dns_servers, search_servers):
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)
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(, [], [])
def test_local_domain(self):
rp = resolv_conf.ResolvConf(BASE_RESOLVE)
self.assertEquals(None, rp.local_domain)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment