2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 09:36:41 +00:00

Fix issue 1567, check attribute switch & switch port

This commit is contained in:
XuWei 2017-01-04 01:55:20 -05:00
parent 6fe66551e1
commit 42aee200dc

View File

@ -315,10 +315,20 @@ sub check_pre_defined_node {
my $keystring;
foreach my $node (keys %nodecheckrst) {
{
last if ($nodecheckrst{$node}{"nodetype"} eq "switch");
my @error_attribute = ();
$keystring = "";
if (!(exists($nodecheckrst{$node}{"switch"}) && exists($nodecheckrst{$node}{"switchport"}))) {
last if ($nodecheckrst{$node}{"nodetype"} eq "switch");
$keystring = "Atrribute 'switch' or 'switchport' isn't defined for '$discovery_type' type discovery";
if (!(exists($nodecheckrst{$node}{"switch"})) or $nodecheckrst{$node}{"switch"} !~ /^\w/) {
push @error_attribute, "switch";
}
if (!(exists($nodecheckrst{$node}{"switchport"})) or $nodecheckrst{$node}{"switchport"} !~ /^\w/) {
push @error_attribute, "switchport";
}
if (@error_attribute) {
$keystring = "Attribute " . join(", ", @error_attribute) . " Invalid";
last;
} else {
my $switchport = "$nodecheckrst{$node}{\"switch\"}*$nodecheckrst{$node}{\"switchport\"}";