← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~harlowja/cloud-init/encode-resolve-fix into lp:cloud-init

 

Joshua Harlow has proposed merging lp:~harlowja/cloud-init/encode-resolve-fix into lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)
Related bugs:
  Bug #1479988 in cloud-init: "AttributeError: 'ResolvConf' object has no attribute 'encode'"
  https://bugs.launchpad.net/cloud-init/+bug/1479988

For more details, see:
https://code.launchpad.net/~harlowja/cloud-init/encode-resolve-fix/+merge/266490
-- 
Your team cloud init development team is requested to review the proposed merge of lp:~harlowja/cloud-init/encode-resolve-fix into lp:cloud-init.
=== modified file 'cloudinit/distros/rhel_util.py'
--- cloudinit/distros/rhel_util.py	2015-01-27 19:24:22 +0000
+++ cloudinit/distros/rhel_util.py	2015-07-30 22:20:35 +0000
@@ -86,4 +86,4 @@
                 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)

=== modified file 'tests/unittests/test_distros/test_resolv.py'
--- tests/unittests/test_distros/test_resolv.py	2015-01-27 01:02:31 +0000
+++ tests/unittests/test_distros/test_resolv.py	2015-07-30 22:20:35 +0000
@@ -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 @@
         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)