From 9033696575e0754c351fc6620ae70e9a3afdfccc Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Sun, 30 Oct 2011 17:29:51 -0400 Subject: 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 Patch5: cloud-init-0.6.2-tzsysconfig.patch --- cloudinit/CloudConfig/cc_timezone.py | 7 +++++++ 1 file changed, 7 insertions(+) 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") -- cgit v1.2.3