From 865bc40654354ccc6e2ffd97b7f6b361008c4e0b Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Wed, 25 Mar 2015 09:55:51 +0100 Subject: Added ntpServiceConfig attribute --- lib/ManaTools/Shared/TimeZone.pm | 61 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 deletions(-) (limited to 'lib/ManaTools/Shared') diff --git a/lib/ManaTools/Shared/TimeZone.pm b/lib/ManaTools/Shared/TimeZone.pm index c1a1331b..3be11d77 100644 --- a/lib/ManaTools/Shared/TimeZone.pm +++ b/lib/ManaTools/Shared/TimeZone.pm @@ -172,6 +172,45 @@ sub _ntp_program_init { #============================================================= +=head2 attribute + +=head3 ntpServiceConfig + + This RO attribute is a HashRef containing managed ntp + service as key and related configuration file. + + Allowed actions: + getNTPServiceConfig => retrieves config file from the + given ntp service + ntpServiceConfigPairs => Key,Value pairs access + +=cut + +#============================================================= +has 'ntpServiceConfig' => ( + traits => ['Hash'], + default => sub { { + 'chronyd' => '/etc/chrony.conf', + 'ntpd' => '/etc/ntp.conf', + 'systemd-timesyncd' => '/etc/systemd/timesyncd.conf' + } }, + is => 'ro', + isa => 'HashRef', + handles => { + getNTPServiceConfig => 'get', + ntpServiceConfigPairs => 'kv', + }, + init_arg => undef, +); + +# has 'dmlist' => ( +# is => 'rw', +# isa => 'ArrayRef', +# builder => '_build_dmlist', +# ); + +#============================================================= + =head2 new - optional parameters =head3 installer_or_livecd @@ -737,7 +776,6 @@ Returns the current ntp server address read from configuration file =cut #============================================================= - sub ntpCurrentServer { my $self = shift; @@ -746,6 +784,25 @@ sub ntpCurrentServer { #============================================================= +=head2 currentNTPService + +=head3 DESCRIPTION + + Returns the current ntp service + +=cut + +#============================================================= +sub currentNTPService { + my $self = shift; + + my $ntpd = $self->ntp_program; + + return $ntpd; +} + +#============================================================= + =head2 isNTPRunning =head3 DESCRIPTION @@ -758,8 +815,6 @@ sub ntpCurrentServer { sub isNTPRunning { my $self = shift; - $DB::single = 1; - my $ntpd = $self->ntp_program; my $isRunning = $self->sh_services->is_service_running($ntpd); -- cgit v1.2.1