diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 53fd31c9b..7587f4fb2 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -760,11 +760,19 @@ sub preprocess_request { my $command = $request->{command}->[0]; my $python_env = xCAT::OPENBMC->is_openbmc_python($request->{environment}); # Process command in this module only if PYTHON env is not ALL or command is - # listed in the PYTHON env list. All other cases => return - if (($python_env eq "ALL") || - (($python_env ne "NO") && ($python_env =~ $command))) { - $request = {}; - return; + # listed in the PYTHON env list (without EXCEPT: prefix. + # All other cases => return + SWITCH: { + if ($python_env eq "ALL") {$request = {}; return;} + if ($python_env eq "NO") {last SWITCH;} + if ($python_env !~ $command) { + if ($python_env =~ /^EXCEPT:/) {$request = {}; return;} + else {last SWITCH;} + } + if ($python_env =~ $command) { + if ($python_env =~ /^EXCEPT:/) {last SWITCH;} + else {$request = {}; return;} + } } if ($::XCATSITEVALS{xcatdebugmode}) { $xcatdebugmode = $::XCATSITEVALS{xcatdebugmode} } diff --git a/xCAT-server/lib/xcat/plugins/openbmc2.pm b/xCAT-server/lib/xcat/plugins/openbmc2.pm index 69820a057..efd38e9e0 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc2.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc2.pm @@ -60,11 +60,20 @@ sub preprocess_request { my $command = $request->{command}->[0]; my $python_env = xCAT::OPENBMC->is_openbmc_python($request->{environment}); # Process command in this module only if PYTHON env is not NO or - # command is listed in the PYTHON env list. All other cases => return - if (($python_env eq "NO") || - (($python_env ne "ALL") && ($python_env !~ $command))) { - $request = {}; - return; + # command is listed in the PYTHON env list (without EXCEPT: prefix). + # All other cases => return + + SWITCH: { + if ($python_env eq "NO") {$request = {}; return;} + if ($python_env eq "ALL") {last SWITCH;} + if ($python_env !~ $command) { + if ($python_env =~ /^EXCEPT:/) {last SWITCH} + else {$request = {}; return;} + } + if ($python_env =~ $command) { + if ($python_env =~ /^EXCEPT:/) {$request = {}; return;} + else {last SWITCH;} + } } my $noderange = $request->{node};