mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-07-31 18:19:40 +00:00
fix(goconserver): manage the service via systemd instead of the service command
Goconserver.pm shells out to `service goconserver start|stop|restart` (and
`service conserver stop`). That command is provided by the initscripts package,
which is NOT installed on a minimal EL9/EL10 management node -- there, every one
of these calls fails with rc!=0.
The damaging case is restart_service(). makegocons calls build_conf(), which
rewrites /etc/goconserver/server.conf with the cert-enabled configuration
(global.ssl_key_file/ssl_cert_file/ssl_ca_cert_file), and then calls
restart_service() so the daemon picks it up. When the restart fails, xCAT only
logs "Could not restart goconserver service." and the daemon keeps running with
the configuration it read at boot -- the packaged default, which has no ssl_*
fields. goconserver's TLS is gated on those fields being set (sslEnable stays
false), so it silently serves plain HTTP on the api port while Goconserver.pm
always talks to it over https. Every subsequent request then dies with
SSL connect attempt failed error:0A0000C6:SSL routines::packet length too long
so makegocons/makegocons -d report "Failed to send delete request." and the
console can never be registered. On EL8 the bug is invisible because initscripts
happens to be installed there.
Use the xCAT::Utils service helpers (startservice/stopservice/restartservice),
which resolve the unit through servicemap() and issue `systemctl <action> <unit>`
on systemd hosts, falling back to `service`/`initctl` only where appropriate.
This is the same mechanism the rest of the tree (AAsn.pm and friends) already
uses for named, dhcpd, nfs and others.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -667,9 +667,7 @@ sub build_conf {
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub start_service {
|
||||
my $cmd = "service goconserver start";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
if (xCAT::Utils->startservice("goconserver") != 0) {
|
||||
xCAT::MsgUtils->message("S", "Could not start goconserver service.");
|
||||
return 1;
|
||||
}
|
||||
@@ -694,9 +692,7 @@ sub start_service {
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub stop_service {
|
||||
my $cmd = "service goconserver stop";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
if (xCAT::Utils->stopservice("goconserver") != 0) {
|
||||
xCAT::MsgUtils->message("S", "Could not stop goconserver service.");
|
||||
return 1;
|
||||
}
|
||||
@@ -721,9 +717,7 @@ sub stop_service {
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub stop_conserver_service {
|
||||
my $cmd = "service conserver stop";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
if (xCAT::Utils->stopservice("conserver") != 0) {
|
||||
xCAT::MsgUtils->message("S", "Could not stop conserver service.");
|
||||
return 1;
|
||||
}
|
||||
@@ -747,9 +741,7 @@ sub stop_conserver_service {
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub restart_service {
|
||||
my $cmd = "service goconserver restart";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
if (xCAT::Utils->restartservice("goconserver") != 0) {
|
||||
xCAT::MsgUtils->message("S", "Could not restart goconserver service.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user