Commit ff753403 authored by Robert Ricci's avatar Robert Ricci

Add a sanity check to make sure that we have appropriate stacks for

all ports that have been specified.
parent e375c3a9
......@@ -465,6 +465,7 @@ foreach my $command (@commands) {
# Now, make the object for each stack that we discovered
#
my @stacks;
my %stack_ids;
foreach my $stack_id (keys %stacks) {
my ($stack_type, $supports_private, $single_domain, $community)
= getStackType($stack_id);
......@@ -509,6 +510,24 @@ foreach my $command (@commands) {
die "Unable to connect to one or more switches, exiting\n";
} else {
push @stacks, $stack;
$stack_ids{$stack_id} = $stack;
}
}
#
# If we were given ports, make sure that the stack(s) that got created
# cover all of them
#
if (@ports) {
my %devicemap = mapPortsToDevices(@ports);
my @devices = keys %devicemap;
foreach my $device (@devices) {
my $stack_id = getSwitchStack($device);
if (!$stack_id || !$stack_ids{$stack_id}) {
die "*** ERROR: One or more ports are on $device, but no " .
"stack containing it was specified!\n";
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment