Author: mzugec Date: Fri Sep 4 14:28:11 2009 New Revision: 58527 URL: http://svn.opensuse.org/viewcvs/yast?rev=58527&view=rev Log: YaPI: improved read of interfaces data Modified: trunk/network/src/lan/YaPI/NETWORK.pm Modified: trunk/network/src/lan/YaPI/NETWORK.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/YaPI/NETWORK.pm?rev=58527&r1=58526&r2=58527&view=diff ============================================================================== --- trunk/network/src/lan/YaPI/NETWORK.pm (original) +++ trunk/network/src/lan/YaPI/NETWORK.pm Fri Sep 4 14:28:11 2009 @@ -8,7 +8,6 @@ # ------------------- imported modules YaST::YCP::Import ("LanItems"); -YaST::YCP::Import ("NetworkInterfaces"); YaST::YCP::Import ("DNS"); YaST::YCP::Import ("Routing"); # ------------------------------------- @@ -27,27 +26,20 @@ DNS->Read(); Routing->Read(); LanItems->Read(); - NetworkInterfaces->Read(); my %interfaces = (); foreach my $devnum (keys %{LanItems->Items}){ - my $devname= %{LanItems->Items}->{$devnum}->{'hwinfo'}->{'dev_name'}; - my $name = %{LanItems->Items}->{$devnum}->{'ifcfg'}; - if ($name ne ""){ + LanItems->current($devnum); + if (LanItems->IsItemConfigured()){ my %configuration = (); - NetworkInterfaces->Select($name); - my %config = %{NetworkInterfaces->Current}; - my $bootproto = %config->{'BOOTPROTO'}; - switch($bootproto){ - case "dhcp" { - %configuration = ( 'bootproto' => 'dhcp' ); - } - case "static" { - %configuration = ( 'bootproto' => 'static' ); - %configuration->{'ipaddr'} = %config->{'IPADDR'} . "/" . %config->{'PREFIXLEN'} - } - } - $interfaces{$name}=\%configuration; + LanItems->SetItem(); + if (LanItems->isCurrentDHCP()){ + %configuration = ( 'bootproto' => LanItems->bootproto ); + } elsif (LanItems->bootproto eq "static"){ + %configuration = ( 'bootproto' => 'static' ); + %configuration->{'ipaddr'} = LanItems->ipaddr . "/" . LanItems->prefix; + } + $interfaces{LanItems->interfacename}=\%configuration; } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org