TT#66754 Refactor status gatherer program check into a function

Let's encapsulate the knowledge about ngcp-collective-check into the
same perl module, instead of leaking the implementation details in
multiple places.

Change-Id: I3efe0b9704f9c149dae50bf4d323853b819127c8
changes/85/34785/2
Guillem Jover 6 years ago
parent a87b41ce23
commit 34d8db19ce

@ -86,6 +86,12 @@ sub get_dpkg_support_status {
}
}
sub has_ngcp_status {
my $self = shift;
return -x '/usr/sbin/ngcp-collective-check';
}
sub get_ngcp_status {
my ($self) = @_;
return `/usr/sbin/ngcp-collective-check json`;

@ -8,7 +8,7 @@ use NGCP::Panel::Utils::Statistics;
use JSON qw(decode_json);
sub template {
return unless ( -e '/usr/sbin/ngcp-collective-check' );
return unless NGCP::Panel::Utils::Statistics::has_ngcp_status();
return 'widgets/admin_system_overview.tt';
}

Loading…
Cancel
Save