From 0ff9bc0be53210d9b27665045d98c27618d698fd Mon Sep 17 00:00:00 2001 From: bxuxa Date: Thu, 21 Mar 2019 16:46:20 +0800 Subject: [PATCH] Ignore the disable when not installed, not using package checking as we use a fake package there --- xCAT-server/lib/perl/xCAT/Goconserver.pm | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Goconserver.pm b/xCAT-server/lib/perl/xCAT/Goconserver.pm index ce095116f..a6eea15d5 100644 --- a/xCAT-server/lib/perl/xCAT/Goconserver.pm +++ b/xCAT-server/lib/perl/xCAT/Goconserver.pm @@ -503,11 +503,13 @@ sub is_goconserver_running { sub switch_goconserver { my $callback = shift; # ignore SN as it is handled by AAsn - if ((-x "/usr/bin/systemctl" || -x "-x /bin/systemctl") && !$isSN) { + if ((-x "/usr/bin/systemctl" || -x "/bin/systemctl") && !$isSN) { my $cmd = "systemctl disable conserver"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) { - xCAT::MsgUtils->warn_message("Failed to execute command: $cmd.", $callback); + if (-x "/usr/sbin/conserver") { + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->warn_message("Failed to execute command: $cmd.", $callback); + } } $cmd = "systemctl enable goconserver"; xCAT::Utils->runcmd($cmd, -1); @@ -537,9 +539,11 @@ sub switch_conserver { # ignore SN as it is handled by AAsn if ((-x "/usr/bin/systemctl" || -x "-x /bin/systemctl") && !$isSN) { my $cmd = "systemctl disable goconserver"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) { - xCAT::MsgUtils->warn_message("Failed to execute command: $cmd.", $callback); + if (-x "/usr/bin/goconserver") { + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->warn_message("Failed to execute command: $cmd.", $callback); + } } $cmd = "systemctl enable conserver"; xCAT::Utils->runcmd($cmd, -1);