Merge lp:~harlowja/cloud-init/encode-resolve-fix into lp:~cloud-init-dev/cloud-init/trunk

Proposed by Joshua Harlow
Status: Merged
Merged at revision: 1201
Proposed branch: lp:~harlowja/cloud-init/encode-resolve-fix
Merge into: lp:~cloud-init-dev/cloud-init/trunk
Diff against target: 33 lines (+7/-1)
2 files modified
cloudinit/distros/rhel_util.py (+1/-1)
tests/unittests/test_distros/test_resolv.py (+6/-0)
To merge this branch: bzr merge lp:~harlowja/cloud-init/encode-resolve-fix
Reviewer Review Type Date Requested Status
Scott Moser Approve
Review via email: mp+266490@code.launchpad.net
To post a comment you must log in.
Scott Moser (smoser) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cloudinit/distros/rhel_util.py'
2--- cloudinit/distros/rhel_util.py 2015-01-27 19:24:22 +0000
3+++ cloudinit/distros/rhel_util.py 2015-07-30 22:20:35 +0000
4@@ -86,4 +86,4 @@
5 r_conf.add_search_domain(s)
6 except ValueError:
7 util.logexc(LOG, "Failed at adding search domain %s", s)
8- util.write_file(fn, r_conf, 0o644)
9+ util.write_file(fn, str(r_conf), 0o644)
10
11=== modified file 'tests/unittests/test_distros/test_resolv.py'
12--- tests/unittests/test_distros/test_resolv.py 2015-01-27 01:02:31 +0000
13+++ tests/unittests/test_distros/test_resolv.py 2015-07-30 22:20:35 +0000
14@@ -1,6 +1,8 @@
15 from cloudinit.distros.parsers import resolv_conf
16+from cloudinit.distros import rhel_util
17
18 import re
19+import tempfile
20 from ..helpers import TestCase
21
22
23@@ -19,6 +21,10 @@
24 rp_r = str(rp).strip()
25 self.assertEquals(BASE_RESOLVE, rp_r)
26
27+ def test_write_works(self):
28+ with tempfile.NamedTemporaryFile() as fh:
29+ rhel_util.update_resolve_conf_file(fh.name, [], [])
30+
31 def test_local_domain(self):
32 rp = resolv_conf.ResolvConf(BASE_RESOLVE)
33 self.assertEquals(None, rp.local_domain)