summaryrefslogtreecommitdiff
path: root/cloudinit/CloudConfig
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-10-30 17:29:51 -0400
committerScott Moser <smoser@ubuntu.com>2011-10-30 17:29:51 -0400
commit9033696575e0754c351fc6620ae70e9a3afdfccc (patch)
tree8598c40fdb4bc077670ddbfa7bc77935e0539302 /cloudinit/CloudConfig
parentf616a9acc581d6ac2fb4ebcaa49570cc0be744ce (diff)
downloadvyos-cloud-init-9033696575e0754c351fc6620ae70e9a3afdfccc.tar.gz
vyos-cloud-init-9033696575e0754c351fc6620ae70e9a3afdfccc.zip
Write timezone data to /etc/sysconfig/clock
If the file /etc/sysconfig/clock exists, assume fedora style timezone config and write 'ZONE="%s' to that file. taken from git://pkgs.fedoraproject.org/cloud-init.git commit 87f33190f43d2b26cced4597e7298835024466c2 Author: Garrett Holmstrom <gholms@fedoraproject.org> Patch5: cloud-init-0.6.2-tzsysconfig.patch
Diffstat (limited to 'cloudinit/CloudConfig')
-rw-r--r--cloudinit/CloudConfig/cc_timezone.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/cloudinit/CloudConfig/cc_timezone.py b/cloudinit/CloudConfig/cc_timezone.py
index a26df8f9..e8a453f9 100644
--- a/cloudinit/CloudConfig/cc_timezone.py
+++ b/cloudinit/CloudConfig/cc_timezone.py
@@ -45,6 +45,13 @@ def handle(name,cfg,cloud,log,args):
except:
log.debug("failed to write to /etc/timezone")
raise
+ if os.path.exists("/etc/sysconfig/clock"):
+ try:
+ with open("/etc/sysconfig/clock", "w") as fp:
+ fp.write('ZONE="%s"\n' % timezone)
+ except:
+ log.debug("failed to write to /etc/sysconfig/clock")
+ raise
try:
shutil.copy(tz_file, "/etc/localtime")