Bug #12775
closedNTP service is not listed on ``status_services.php`` unless ``config.xml`` contains NTP configuration data
100%
Description
The NTP service is active by default and is running even on a fresh installation before the user configures NTP, which is expected and correct.
However, status_services.php
does not list the ntpd
service until the user saves the NTP settings (e.g. Services > NTP , click Save) even if they make no changes. This populates config.xml
with an NTP config section which is not present in the default configuration.
The code in get_services()
in etc/inc/service-utils.inc
checks for the presence of the NTP config which isn't a prerequisite for the service to be active. The check appears to be a safety check to ensure that the actual check for the disabled flag will not cause a PHP error.
This change works around the need for that safety check without adding more potentially confusing logic to the test:
diff --git a/src/etc/inc/service-utils.inc b/src/etc/inc/service-utils.inc
index 35a74f74af..6bc304ba20 100644
--- a/src/etc/inc/service-utils.inc
+++ b/src/etc/inc/service-utils.inc
@@ -279,7 +279,8 @@ function get_services() {
$services[] = $pconfig;
}
- if (is_array($config['ntpd']) && ($config['ntpd']['enable'] != 'disabled')) {
+ init_config_arr(array('ntpd'));
+ if ($config['ntpd']['enable'] != 'disabled') {
$pconfig = array();
$pconfig['name'] = "ntpd";
$pconfig['description'] = gettext("NTP clock sync");