api/services: whitespace cleanup, modern closure call

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-07-24 13:47:39 +02:00
parent e51cd02b5c
commit 05d5632db2

View File

@ -33,7 +33,7 @@ my $service_name_list = [
'postfix',
'ksmtuned',
'systemd-timesyncd',
];
];
# since postfix package 3.1.0-3.1 the postfix unit is only here to
# manage subinstances, of which the default is called "-".
@ -269,7 +269,7 @@ __PACKAGE__->register_method ({
syslog('info', "starting service $param->{service}: $upid\n");
&$service_cmd($param->{service}, 'start');
$service_cmd->($param->{service}, 'start');
};
@ -308,7 +308,7 @@ __PACKAGE__->register_method ({
syslog('info', "stopping service $param->{service}: $upid\n");
&$service_cmd($param->{service}, 'stop');
$service_cmd->($param->{service}, 'stop');
};
@ -339,16 +339,13 @@ __PACKAGE__->register_method ({
my ($param) = @_;
my $rpcenv = PVE::RPCEnvironment::get();
my $user = $rpcenv->get_user();
my $realcmd = sub {
my $upid = shift;
syslog('info', "re-starting service $param->{service}: $upid\n");
&$service_cmd($param->{service}, 'restart');
$service_cmd->($param->{service}, 'restart');
};
return $rpcenv->fork_worker('srvrestart', $param->{service}, $user, $realcmd);
@ -378,15 +375,13 @@ __PACKAGE__->register_method ({
my ($param) = @_;
my $rpcenv = PVE::RPCEnvironment::get();
my $user = $rpcenv->get_user();
my $realcmd = sub {
my $upid = shift;
syslog('info', "reloading service $param->{service}: $upid\n");
&$service_cmd($param->{service}, 'reload');
$service_cmd->($param->{service}, 'reload');
};