aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ManaTools/Shared
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2015-03-25 11:22:36 +0100
committerAngelo Naselli <anaselli@linux.it>2015-03-25 11:22:36 +0100
commit031f000833f385de8bc5142c571aec73399b4a1a (patch)
tree01ceb0781d87622e416c5b2286c23d5688532fec /lib/ManaTools/Shared
parentb416dfb9d082d59c45adb67affc89f5f1c3994cc (diff)
downloadmanatools-031f000833f385de8bc5142c571aec73399b4a1a.tar
manatools-031f000833f385de8bc5142c571aec73399b4a1a.tar.gz
manatools-031f000833f385de8bc5142c571aec73399b4a1a.tar.bz2
manatools-031f000833f385de8bc5142c571aec73399b4a1a.tar.xz
manatools-031f000833f385de8bc5142c571aec73399b4a1a.zip
added refreshNTPServiceList attribute and its test
Diffstat (limited to 'lib/ManaTools/Shared')
-rw-r--r--lib/ManaTools/Shared/TimeZone.pm28
1 files changed, 25 insertions, 3 deletions
diff --git a/lib/ManaTools/Shared/TimeZone.pm b/lib/ManaTools/Shared/TimeZone.pm
index 46810db0..155de20d 100644
--- a/lib/ManaTools/Shared/TimeZone.pm
+++ b/lib/ManaTools/Shared/TimeZone.pm
@@ -209,8 +209,9 @@ has 'ntpServiceConfig' => (
=head3 ntpServiceList
- This attribute is a ArrayRef containing configured ntp
- service into the system, retrieving info from services.
+ This attribute is a ArrayRef containing the sorted list of
+ configured NTP service into the system, retrieving info from
+ services.
=cut
@@ -232,7 +233,7 @@ sub _build_ntpServiceList {
push @list, $pair->[0] if eval {$self->sh_services->dbus_systemd1_object->GetUnitFileState( $pair->[0] . ".service")};
}
- return \@list;
+ return [ sort(@list) ];
}
#=============================================================
@@ -435,6 +436,27 @@ sub _buildNTPServers {
#=============================================================
+=head2 refreshNTPServiceList
+
+=head3 DESCRIPTION
+
+ Refresh the ntpServiceList attribute value, usefull
+ if any NTP service has been istalled after having
+ instantiated this object
+
+=cut
+
+#=============================================================
+sub refreshNTPServiceList {
+ my $self = shift;
+
+ my $list = $self->_build_ntpServiceList();
+
+ $self->ntpServiceList($list);
+}
+
+#=============================================================
+
=head2 get_timezone_prefix
=head3 OUTPUT