2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-26 01:34:05 +00:00

fix: use runtime require for xCAT::DHCP::Backend in dhcpop

The xCAT-server build-readme script runs every tool in share/xcat/tools/
with --help during RPM packaging. At build time perl-xCAT is not installed,
so the compile-time 'use xCAT::DHCP::Backend' aborts before --help can run.

Switch to runtime require inside the remove-operation branch where the
module is actually needed.
This commit is contained in:
Vinícius Ferrão
2026-05-06 02:55:11 -03:00
parent 0649b4c4ac
commit 911c74fda6
+1 -1
View File
@@ -11,7 +11,6 @@ use lib "$::XCATROOT/lib/perl";
use Getopt::Long;
use Fcntl ':flock';
use xCAT::DHCP::Backend;
sub usage{
print "Usage: dhcphelper -h \n";
@@ -39,6 +38,7 @@ if($help){
&usage;
exit 0;
}elsif($rmop){
require xCAT::DHCP::Backend;
my $backend = xCAT::DHCP::Backend->new_backend();
if (ref($backend) ne 'HASH' && $backend->name eq 'kea') {
if ($mac && $mac !~ /:/) {