mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 09:13:08 +00:00
group validation (#4945)
This commit is contained in:
parent
0db3add42c
commit
a6a14d3bfe
@ -4721,12 +4721,20 @@ sub initialize_variables
|
||||
sub isobjnamevalid{
|
||||
my $objname=shift;
|
||||
my $objtype=shift;
|
||||
my %options;
|
||||
$options{keepmissing}=1;
|
||||
$options{genericrange}=1;
|
||||
$objtype="node" unless(defined $objtype and ($objtype ne ""));
|
||||
if($objtype eq "node"){
|
||||
#the ip address as a valid node object name is a hack for p7IH support
|
||||
if(($objname !~ /^[a-zA-Z0-9-_]+$/) and !xCAT::NetworkUtils->isIpaddr($objname)){
|
||||
return 0;
|
||||
}
|
||||
} elsif ($objtype eq "group"){
|
||||
my @tmpnodes=xCAT::NodeRange::noderange($objname,0,0,%options);
|
||||
if(scalar(@tmpnodes)>1 || $tmpnodes[0] ne $objname ){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user