diff options
author | Joshua Harlow <harlowja@gmail.com> | 2013-08-05 07:03:17 +0100 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-08-05 07:03:17 +0100 |
commit | 270341583ff0c83b4e10ec3d1040b95555f7232f (patch) | |
tree | 64555168d9767f63074729cdbe9d34e5ae37eb01 /cloudinit/distros/__init__.py | |
parent | 219191673b5491fab683ca5ff1befe845c81f6cf (diff) | |
parent | 65e49111bcea78342289c671376eba85410ea781 (diff) | |
download | vyos-cloud-init-270341583ff0c83b4e10ec3d1040b95555f7232f.tar.gz vyos-cloud-init-270341583ff0c83b4e10ec3d1040b95555f7232f.zip |
reduce finding time zone file to top level distro
remove duplicates of some code.
Diffstat (limited to 'cloudinit/distros/__init__.py')
-rw-r--r-- | cloudinit/distros/__init__.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index 249e1b19..74e95797 100644 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -47,9 +47,11 @@ LOG = logging.getLogger(__name__) class Distro(object): __metaclass__ = abc.ABCMeta + hosts_fn = "/etc/hosts" ci_sudoers_fn = "/etc/sudoers.d/90-cloud-init-users" hostname_conf_fn = "/etc/hostname" + tz_zone_dir = "/usr/share/zoneinfo" def __init__(self, name, cfg, paths): self._paths = paths @@ -66,6 +68,13 @@ class Distro(object): # to write this blob out in a distro format raise NotImplementedError() + def _find_tz_file(self, tz): + tz_file = os.path.join(self.tz_zone_dir, str(tz)) + if not os.path.isfile(tz_file): + raise IOError(("Invalid timezone %s," + " no file found at %s") % (tz, tz_file)) + return tz_file + def get_option(self, opt_name, default=None): return self._cfg.get(opt_name, default) |