Merge lp:~smoser/cloud-init/trunk.lp1543025 into lp:~cloud-init-dev/cloud-init/trunk

Proposed by Scott Moser
Status: Merged
Merged at revision: 1167
Proposed branch: lp:~smoser/cloud-init/trunk.lp1543025
Merge into: lp:~cloud-init-dev/cloud-init/trunk
Diff against target: 27 lines (+7/-1)
2 files modified
ChangeLog (+2/-0)
cloudinit/distros/__init__.py (+5/-1)
To merge this branch: bzr merge lp:~smoser/cloud-init/trunk.lp1543025
Reviewer Review Type Date Requested Status
Martin Pitt (community) Approve
cloud-init Commiters Pending
Review via email: mp+287682@code.launchpad.net

Commit message

timezone: use a symlink when updating /etc/localtime

Unless /etc/localtime is an existing file and not a symlink,
then we will symlink instead of copying the tz_file to /etc/localtime.

The copy was due to an old bug in Ubuntu, symlink should be preferred.

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

but this can only be fine, if /usr is mounted in the initramfs, or /usr is not a separate mount point.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks for fixing this! Maybe you want to update the commit message, as this was not really due "to an old bug in Ubuntu", but we just forgot to change this along with tzdata.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2016-03-01 05:51:26 +0000
3+++ ChangeLog 2016-03-01 17:33:06 +0000
4@@ -81,6 +81,8 @@
5 - lxd: add support for setting up lxd using 'lxd init' (LP: #1522879)
6 - Add Image Customization Parser for VMware vSphere Hypervisor
7 Support. [Sankar Tanguturi]
8+ - timezone: use a symlink rather than copy for /etc/localtime
9+ unless it is already a file (LP: #1543025).
10
11 0.7.6:
12 - open 0.7.6
13
14=== modified file 'cloudinit/distros/__init__.py'
15--- cloudinit/distros/__init__.py 2015-07-22 12:06:34 +0000
16+++ cloudinit/distros/__init__.py 2016-03-01 17:33:06 +0000
17@@ -897,5 +897,9 @@
18 util.write_file(tz_conf, str(tz).rstrip() + "\n")
19 # This ensures that the correct tz will be used for the system
20 if tz_local and tz_file:
21- util.copy(tz_file, tz_local)
22+ # use a symlink if there exists a symlink or tz_local is not present
23+ if os.path.islink(tz_local) or not os.path.exists(tz_local):
24+ os.symlink(tz_file, tz_local)
25+ else:
26+ util.copy(tz_file, tz_local)
27 return