~smoser/ubuntu/vivid/cloud-init/snappy

« back to all changes in this revision

Viewing changes to tests/unittests/test_handler/test_handler_set_hostname.py

  • Committer: Scott Moser
  • Date: 2015-02-27 20:55:58 UTC
  • mfrom: (355.2.8 vivid)
  • Revision ID: smoser@ubuntu.com-20150227205558-glrwdgxqkaz6zyxa
* Merge with vivid at 0.7.7~bzr1067-0ubuntu1
* New upstream snapshot.
  * fix broken consumption of gzipped user-data (LP: #1424900)
  * functional user-data on Azure again (LP: #1423972)
  * CloudStack: support fetching password from virtual router (LP: #1422388)
* New upstream snapshot.
  * Fix for ascii decode in DataSourceAzure (LP: #1422993).
* New upstream snapshot.
  * support for gpt partitioning, utilized in Azure [Daniel Watkins]
  * fix bug in exception handling in mount_cb.
* New upstream snapshot.
  * move to python3 (LP: #1247132)
  * systemd: run cloud-init before systemd-user-sessions.service
  * Use the GCE short hostname. (LP: #1383794)
  * Enable user-data encoding support for GCE. (LP: #1404311)
  * Update to use a newer and better OMNIBUS_URL
  * Be more tolerant of 'ssh_authorized_keys' types
  * Fix parse_ssh_config failing in ssh_util.py
  * Increase the robustness/configurability of the chef module.
  * retain trailing newline from template files when using
    jinja2 (LP: #1355343)
  * fix broken output handling (LP: #1387340)
  * digital ocean datasource
  * update url in config drive documentation
  * freebsd: enable correct behavior on Ec2.
  * freebsd: Use the proper virtio FreeBSD network interface name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
from .. import helpers as t_help
9
9
 
 
10
import shutil
 
11
import tempfile
10
12
import logging
11
13
 
12
 
from StringIO import StringIO
 
14
from six import BytesIO
13
15
 
14
16
from configobj import ConfigObj
15
17
 
19
21
class TestHostname(t_help.FilesystemMockingTestCase):
20
22
    def setUp(self):
21
23
        super(TestHostname, self).setUp()
22
 
        self.tmp = self.makeDir(prefix="unittest_")
 
24
        self.tmp = tempfile.mkdtemp()
 
25
        self.addCleanup(shutil.rmtree, self.tmp)
23
26
 
24
27
    def _fetch_distro(self, kind):
25
28
        cls = distros.fetch(kind)
38
41
        cc_set_hostname.handle('cc_set_hostname',
39
42
                               cfg, cc, LOG, [])
40
43
        if not distro.uses_systemd():
41
 
            contents = util.load_file("/etc/sysconfig/network")
42
 
            n_cfg = ConfigObj(StringIO(contents))
 
44
            contents = util.load_file("/etc/sysconfig/network", decode=False)
 
45
            n_cfg = ConfigObj(BytesIO(contents))
43
46
            self.assertEquals({'HOSTNAME': 'blah.blah.blah.yahoo.com'},
44
47
                              dict(n_cfg))
45
48