Updated tzsysconfig patch

This commit is contained in:
Garrett Holmstrom 2011-09-23 10:49:01 -07:00
parent 4907847669
commit c29b44528c
2 changed files with 9 additions and 21 deletions

View File

@ -2,26 +2,11 @@ Index: cloud-init/cloudinit/CloudConfig/cc_timezone.py
===================================================================
--- cloud-init.orig/cloudinit/CloudConfig/cc_timezone.py
+++ cloud-init/cloudinit/CloudConfig/cc_timezone.py
@@ -38,13 +38,21 @@ def handle(name,cfg,cloud,log,args):
log.debug("Invalid timezone %s" % tz_file)
raise Exception("Invalid timezone %s" % tz_file)
- try:
- fp=open("/etc/timezone","wb")
- fp.write("%s\n" % timezone)
- fp.close()
- except:
- log.debug("failed to write to /etc/timezone")
- raise
+ if os.path.exists("/etc/timezone"):
+ try:
+ fp=open("/etc/timezone","wb")
+ fp.write("%s\n" % timezone)
+ fp.close()
+ except:
+ log.debug("failed to write to /etc/timezone")
+ raise
+ elif os.path.exists("/etc/sysconfig/clock"):
@@ -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)

View File

@ -2,7 +2,7 @@
Name: cloud-init
Version: 0.6.2
Release: 0.1.bzr450%{?dist}
Release: 0.2.bzr450%{?dist}
Summary: EC2 instance init scripts
Group: System Environment/Base
@ -150,5 +150,8 @@ fi
%changelog
* Fri Sep 23 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.2.bzr450
- Updated tzsysconfig patch
* Wed Sep 21 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.1.bzr450
- Initial packaging