summaryrefslogtreecommitdiff
path: root/cloudinit/distros/__init__.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2013-07-24 22:12:33 -0700
committerJoshua Harlow <harlowja@gmail.com>2013-07-24 22:12:33 -0700
commit696bcc1f0acc67646872cd6ce1b90375ca0ae068 (patch)
treea930058df6a51076e7527dadaac099c42ac0d2f6 /cloudinit/distros/__init__.py
parent8f3bfd9db16bfc6cd2acfb068b9ffe14ea1570d3 (diff)
downloadvyos-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__.py9
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)