diff options
author | Joshua Harlow <harlowja@gmail.com> | 2013-07-24 22:12:33 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@gmail.com> | 2013-07-24 22:12:33 -0700 |
commit | 696bcc1f0acc67646872cd6ce1b90375ca0ae068 (patch) | |
tree | a930058df6a51076e7527dadaac099c42ac0d2f6 /cloudinit/distros/__init__.py | |
parent | 8f3bfd9db16bfc6cd2acfb068b9ffe14ea1570d3 (diff) | |
download | vyos-cloud-init-696bcc1f0acc67646872cd6ce1b90375ca0ae068.tar.gz vyos-cloud-init-696bcc1f0acc67646872cd6ce1b90375ca0ae068.zip |
Remove duplicate timezone file finding and error raising.
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) |