summaryrefslogtreecommitdiff
path: root/cloudinit/distros/__init__.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-07-29 09:52:02 -0400
committerScott Moser <smoser@ubuntu.com>2014-07-29 09:52:02 -0400
commit67428ad5a66ee57d1212e5af74cb9e9ed81d2c7b (patch)
treee3ece15c3b28e3cc0ce26b8fe81d72fda1cf7ca8 /cloudinit/distros/__init__.py
parent4b8397a510c4ff6f903e98bef50d350410f41451 (diff)
downloadvyos-cloud-init-67428ad5a66ee57d1212e5af74cb9e9ed81d2c7b.tar.gz
vyos-cloud-init-67428ad5a66ee57d1212e5af74cb9e9ed81d2c7b.zip
do not put comments in /etc/timezone
comments in /etc/timezone are not expected, and can cause problems if another tool tries to read it. LP: #1341710
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 55d6bcbc..1a56dfb3 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -856,3 +856,12 @@ def fetch(name):
mod = importer.import_module(locs[0])
cls = getattr(mod, 'Distro')
return cls
+
+
+def set_etc_timezone(tz, tz_file=None, tz_conf="/etc/timezone",
+ tz_local="/etc/localtime"):
+ util.write_file(tz_conf, str(tz).rstrip() + "\n")
+ # This ensures that the correct tz will be used for the system
+ if tz_local and tz_file:
+ util.copy(tz_file, self.tz_local_fn)
+ return