Part of #634.
system.timezone's apply writes two things:
ln -sf "/usr/share/zoneinfo/$zone" /etc/localtime
printf '%s\n' "$zone" > /etc/timezone
Its observe reads one:
readlink -f /etc/localtime | sed 's#^/usr/share/zoneinfo/##'
A host whose /etc/localtime is right and whose /etc/timezone is wrong — or missing — is
reported converged, and the file stays wrong. That file is what dpkg-reconfigure tzdata,
tzupdate and several distro tools read, so it is not decorative.
The def already carries a note about why it observes the link rather than date +%Z
(seasonal abbreviations). It says nothing about the second file.
Build
Observe both, or stop writing the second one. Observing both is the smaller claim and
matches the apply: state(zone: <link>, recorded: <file contents>).
Worth settling in passing: on a host where /etc/timezone does not exist at all (not every
distribution ships it), writing it is either right or noise — the def's comment about
dpkg-reconfigure suggests Debian is the assumption, and this is a good place to say so.
Validation
- An adverse case: correct link,
/etc/timezone holding another zone, then the def, then
assert the file's contents on the machine. Red first.
coverage.shellf's existing call still converges on a second run.
Part of #634.
system.timezone's apply writes two things:Its observe reads one:
A host whose
/etc/localtimeis right and whose/etc/timezoneis wrong — or missing — isreported converged, and the file stays wrong. That file is what
dpkg-reconfigure tzdata,tzupdateand several distro tools read, so it is not decorative.The def already carries a note about why it observes the link rather than
date +%Z(seasonal abbreviations). It says nothing about the second file.
Build
Observe both, or stop writing the second one. Observing both is the smaller claim and
matches the apply:
state(zone: <link>, recorded: <file contents>).Worth settling in passing: on a host where
/etc/timezonedoes not exist at all (not everydistribution ships it), writing it is either right or noise — the def's comment about
dpkg-reconfiguresuggests Debian is the assumption, and this is a good place to say so.Validation
/etc/timezoneholding another zone, then the def, thenassert the file's contents on the machine. Red first.
coverage.shellf's existing call still converges on a second run.