datetime: Avoid error when systemctl is not available

This situation happens when building the package with cowbuilder.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2021-11-18 09:38:48 -05:00 committed by Sunil Mohan Adapa
parent 122bda7f7e
commit bec080ec90
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -54,7 +54,7 @@ class DateTimeApp(app_module.App):
'--value', 'systemd-timesyncd'
])
self._time_managed = 'yes' in output.decode()
except subprocess.CalledProcessError:
except (FileNotFoundError, subprocess.CalledProcessError):
# When systemd is not running.
self._time_managed = False