Skip to content

Commit

Permalink
Use formal params
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Sep 29, 2024
1 parent c75f29d commit 3ea7b57
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions status/status-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ sub expand_remotes
# an array content, the status of all hosts for this monitor are returned.
sub service_status
{
my $t = $_[0]->{'type'};
my ($serv, $fromcgi) = @_;
my $t = $serv->{'type'};
my @rv;
foreach $r (&expand_remotes($_[0])) {
foreach $r (&expand_remotes($serv)) {
my $rv;
local $main::error_must_die = 1;
eval {
Expand All @@ -173,11 +174,11 @@ sub service_status
'desc' => "$text{'mon_webmin'} : $remote_error_msg" };
}
else {
my %s = %{$_[0]};
my %s = %{$serv};
$s{'remote'} = '*';
$s{'groups'} = undef;
($rv) = &remote_foreign_call($r, 'status',
'service_status', \%s, $_[1]);
'service_status', \%s, $fromcgi);
if ($remote_error_msg) {
$rv = { 'up' => $webmindown, 'desc' =>
"$text{'mon_webmin'} : $remote_error_msg" };
Expand All @@ -189,15 +190,15 @@ sub service_status
my ($mod, $mtype) = ($1, $2);
&foreign_require($mod, "status_monitor.pl");
$rv = &foreign_call($mod, "status_monitor_status",
$mtype, $_[0], $_[1]);
$mtype, $serv, $fromcgi);
}
else {
# Just include and use the local monitor library
do "${t}-monitor.pl" if (!$done_monitor{$t}++);
my $func = "get_${t}_status";
$rv = &$func($_[0],
$_[0]->{'clone'} ? $_[0]->{'clone'} : $t,
$_[1]);
$rv = &$func($serv,
$serv->{'clone'} ? $serv->{'clone'} : $t,
$fromcgi);
}
alarm(0);
};
Expand Down Expand Up @@ -264,24 +265,25 @@ sub list_handlers
# depends_check(&service, [module]+)
sub depends_check
{
return if ($_[0]->{'id'}); # only check for new services
if ($_[0]->{'remote'}) {
my ($serv, @mods) = @_;
return if ($serv->{'id'}); # only check for new services
if ($serv->{'remote'}) {
# Check on the remote server
foreach my $m (@_[1..$#_]) {
&remote_foreign_check($_[0]->{'remote'}, $m, 1) ||
foreach my $m (@mods) {
&remote_foreign_check($serv->{'remote'}, $m, 1) ||
&error(&text('depends_remote', "<tt>$m</tt>",
"<tt>$_[0]->{'remote'}</tt>"));
"<tt>$serv->{'remote'}</tt>"));
}
}
else {
# Check on this server
foreach my $m (@_[1..$#_]) {
foreach my $m (@mods) {
my %minfo = &get_module_info($m);
%minfo || &error(&text('depends_mod', "<tt>$m</tt>"));
&check_os_support(\%minfo, undef, undef, 1) ||
&error(&text('depends_os', "<tt>$minfo{'desc'}</tt>"));
}
$_[0]->{'depends'} = join(" ", @_[1..$#_]);
$_[0]->{'depends'} = join(" ", @mods);
}
}

Expand Down

0 comments on commit 3ea7b57

Please sign in to comment.