~ubuntu-branches/ubuntu/saucy/cloud-init/saucy-proposed

« back to all changes in this revision

Viewing changes to cloudinit/distros/__init__.py

  • Committer: Package Import Robot
  • Author(s): Scott Moser
  • Date: 2013-08-14 21:44:22 UTC
  • mfrom: (1.4.1)
  • Revision ID: package-import@ubuntu.com-20130814214422-uzrq82t5srz2g4c2
Tags: 0.7.3~bzr858-0ubuntu1
* New upstream snapshot.
  * fix resizing of root partition by preferring the functional 'growpart'
    support over the broken 'parted resizepart' support (LP: #1212444)
  * add options for apt_ftp_proxy, apt_https_proxy and apt_config
    (LP: #1057195)

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
class Distro(object):
49
49
    __metaclass__ = abc.ABCMeta
 
50
 
50
51
    hosts_fn = "/etc/hosts"
51
52
    ci_sudoers_fn = "/etc/sudoers.d/90-cloud-init-users"
52
53
    hostname_conf_fn = "/etc/hostname"
 
54
    tz_zone_dir = "/usr/share/zoneinfo"
53
55
 
54
56
    def __init__(self, name, cfg, paths):
55
57
        self._paths = paths
66
68
        # to write this blob out in a distro format
67
69
        raise NotImplementedError()
68
70
 
 
71
    def _find_tz_file(self, tz):
 
72
        tz_file = os.path.join(self.tz_zone_dir, str(tz))
 
73
        if not os.path.isfile(tz_file):
 
74
            raise IOError(("Invalid timezone %s,"
 
75
                           " no file found at %s") % (tz, tz_file))
 
76
        return tz_file
 
77
 
69
78
    def get_option(self, opt_name, default=None):
70
79
        return self._cfg.get(opt_name, default)
71
80