use vars() cache between phases

This commit is contained in:
Oliver Gorwits
2017-10-07 12:43:50 +01:00
parent 08b34e083d
commit b10908a138
7 changed files with 79 additions and 110 deletions

View File

@@ -13,14 +13,14 @@ register_worker({ phase => 'check' }, sub {
return Status->error('Missing port (-p).') if !defined $pn;
return Status->error('Missing vlan (-e).') if !defined $data;
my $port = get_port($device, $pn)
vars->{'port'} = get_port($device, $pn)
or return Status->error("Unknown port name [$pn] on device $device");
my $port_reconfig_check = port_reconfig_check($port);
my $port_reconfig_check = port_reconfig_check(vars->{'port'});
return Status->error("Cannot alter port: $port_reconfig_check")
if $port_reconfig_check;
my $vlan_reconfig_check = vlan_reconfig_check($port);
my $vlan_reconfig_check = vlan_reconfig_check(vars->{'port'});
return Status->error("Cannot alter vlan: $vlan_reconfig_check")
if $vlan_reconfig_check;