[yast-commit] r65483 - in /trunk/network: src/lan/YaPI/NETWORK.pm testsuite/tests/Network_YaPI.out testsuite/tests/Network_YaPI.ycp
Author: mvidner Date: Wed Aug 31 16:50:56 2011 New Revision: 65483 URL: http://svn.opensuse.org/viewcvs/yast?rev=65483&view=rev Log: YaPI::NETWORK: Allow manipulating STARTMODE, don't assume 'auto'. Author: Justus Winter <winter@pre-sense.de> Modified: trunk/network/src/lan/YaPI/NETWORK.pm trunk/network/testsuite/tests/Network_YaPI.out trunk/network/testsuite/tests/Network_YaPI.ycp Modified: trunk/network/src/lan/YaPI/NETWORK.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/lan/YaPI/NETWORK.pm?rev=65483&r1=65482&r2=65483&view=diff ============================================================================== --- trunk/network/src/lan/YaPI/NETWORK.pm (original) +++ trunk/network/src/lan/YaPI/NETWORK.pm Wed Aug 31 16:50:56 2011 @@ -32,13 +32,12 @@ foreach my $devnum (keys %{LanItems->Items}){ LanItems->current($devnum); if (LanItems->IsItemConfigured()){ - my %configuration = (); LanItems->SetItem(); - if (LanItems->isCurrentDHCP()){ - %configuration = ( 'bootproto' => LanItems->bootproto ); - } elsif (LanItems->bootproto eq "static"){ - %configuration = ( 'bootproto' => 'static' ); - + my %configuration = ( + 'startmode' => LanItems->startmode ne ''? LanItems->startmode: 'manual', + 'bootproto' => LanItems->bootproto, + ); + if (LanItems->bootproto eq "static"){ $configuration{'ipaddr'} = LanItems->ipaddr; if (LanItems->prefix ne "") { $configuration{'ipaddr'} .= "/" . LanItems->prefix @@ -142,7 +141,7 @@ NetworkInterfaces->Read(); NetworkInterfaces->Add() unless NetworkInterfaces->Edit($dev); NetworkInterfaces->Name($dev); - my %config=("STARTMODE" => "auto", + my %config=("STARTMODE" => defined $ifc->{'startmode'}? $ifc->{'startmode'}: 'auto', "BOOTPROTO" => defined $ifc->{'bootproto'}? $ifc->{'bootproto'}: 'static', ); if (defined $ifc->{'ipaddr'}) { Modified: trunk/network/testsuite/tests/Network_YaPI.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/testsuite/tests/Network_YaPI.out?rev=65483&r1=65482&r2=65483&view=diff ============================================================================== --- trunk/network/testsuite/tests/Network_YaPI.out (original) +++ trunk/network/testsuite/tests/Network_YaPI.out Wed Aug 31 16:50:56 2011 @@ -13,24 +13,29 @@ Read .init.scripts.exists "SuSEfirewall2_init" false Read .sysconfig.sysctl.IP_FORWARD nil Dir .network.section: ["eth0", "eth1", "eth2", "eth3", "eth4"] -Dir .network.value."eth0": ["BOOTPROTO"] +Dir .network.value."eth0": ["BOOTPROTO", "STARTMODE"] Read .network.value."eth0".BOOTPROTO "dhcp4" -Dir .network.value."eth1": ["BOOTPROTO", "IPADDR", "MTU"] +Read .network.value."eth0".STARTMODE "manual" +Dir .network.value."eth1": ["BOOTPROTO", "IPADDR", "MTU", "STARTMODE"] Read .network.value."eth1".BOOTPROTO "static" Read .network.value."eth1".IPADDR "1.2.3.4/24" Read .network.value."eth1".MTU "1234" -Dir .network.value."eth2": ["BOOTPROTO", "IPADDR", "PREFIXLEN"] +Read .network.value."eth1".STARTMODE "auto" +Dir .network.value."eth2": ["BOOTPROTO", "IPADDR", "PREFIXLEN", "STARTMODE"] Read .network.value."eth2".BOOTPROTO "static" Read .network.value."eth2".IPADDR "1.2.3.5/24" Read .network.value."eth2".PREFIXLEN "" -Dir .network.value."eth3": ["BOOTPROTO", "IPADDR", "PREFIXLEN"] +Read .network.value."eth2".STARTMODE "auto" +Dir .network.value."eth3": ["BOOTPROTO", "IPADDR", "PREFIXLEN", "STARTMODE"] Read .network.value."eth3".BOOTPROTO "static" Read .network.value."eth3".IPADDR "1.2.3.6" Read .network.value."eth3".PREFIXLEN "24" -Dir .network.value."eth4": ["BOOTPROTO", "IPADDR", "NETMASK"] +Read .network.value."eth3".STARTMODE "auto" +Dir .network.value."eth4": ["BOOTPROTO", "IPADDR", "NETMASK", "STARTMODE"] Read .network.value."eth4".BOOTPROTO "static" Read .network.value."eth4".IPADDR "1.2.3.7" Read .network.value."eth4".NETMASK "255.255.255.0" +Read .network.value."eth4".STARTMODE "auto" Read .target.size "/etc/install.inf" 27 Dir .etc.install_inf: [] Read .target.string "/proc/cmdline" "laptop.suse.cz" @@ -46,7 +51,12 @@ Read .target.lstat "/etc/sysconfig/network/ifcfg-tr-usb" nil Execute .target.bash_output "hostname --fqdn" $["exit":0, "stdout":"laptop.suse.cz"] Execute .target.bash_output "hostname --fqdn" $["exit":0, "stdout":"laptop.suse.cz"] -Return $["dns":$["nameservers":["208.67.222.222", "208.67.220.220"], "searches":["suse.cz", "suse.de"]], "hostname":$["dhcp_hostname":"1", "domain":"suse.cz", "name":"laptop"], "interfaces":$["eth0":$["bootproto":"dhcp4", "mtu":""], "eth1":$["bootproto":"static", "ipaddr":"1.2.3.4/24", "mtu":"1234"], "eth2":$["bootproto":"static", "ipaddr":"1.2.3.5/24", "mtu":""], "eth3":$["bootproto":"static", "ipaddr":"1.2.3.6/24", "mtu":""], "eth4":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":""]], "routes":$["default":$["via":"10.20.30.40"]]] +Return $["dns":$["nameservers":["208.67.222.222", "208.67.220.220"], "searches":["suse.cz", "suse.de"]], "hostname":$["dhcp_hostname":"1", "domain":"suse.cz", "name":"laptop"], "interfaces":$["eth0":$["bootproto":"dhcp4", "mtu":"", "startmode":"manual"], "eth1":$["bootproto":"static", "ipaddr":"1.2.3.4/24", "mtu":"1234", "startmode":"auto"], "eth2":$["bootproto":"static", "ipaddr":"1.2.3.5/24", "mtu":"", "startmode":"auto"], "eth3":$["bootproto":"static", "ipaddr":"1.2.3.6/24", "mtu":"", "startmode":"auto"], "eth4":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":"", "startmode":"auto"]], "routes":$["default":$["via":"10.20.30.40"]]] +Return $["error":"", "exit":"0"] +Write .network.value."eth0".BOOTPROTO "dhcp4" true +Write .network.value."eth0".STARTMODE "auto" true +Write .network nil true +Read .init.scripts.exists "network" false Return $["error":"", "exit":"0"] Read .target.size "/etc/sysconfig/network/routes" 27 Read .routes [$["destination":"default", "gateway":"10.20.30.40"]] @@ -85,4 +95,4 @@ Read .target.lstat "/etc/sysconfig/network/ifcfg-tr-usb" nil Execute .target.bash_output "hostname --fqdn" $["exit":0, "stdout":"laptop.suse.cz"] Execute .target.bash_output "hostname --fqdn" $["exit":0, "stdout":"laptop.suse.cz"] -Return $["dns":$["nameservers":["208.67.222.222", "208.67.220.220"], "searches":["suse.cz", "suse.de"]], "hostname":$["dhcp_hostname":"1", "domain":"suse.cz", "name":"laptop"], "interfaces":$["eth0":$["bootproto":"dhcp4", "mtu":""], "eth1":$["bootproto":"static", "ipaddr":"1.2.3.4/24", "mtu":"1234"], "eth2":$["bootproto":"static", "ipaddr":"1.2.3.5/24", "mtu":""], "eth3":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":""], "eth4":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":""]], "routes":$["default":$["via":"10.20.30.40"]]] +Return $["dns":$["nameservers":["208.67.222.222", "208.67.220.220"], "searches":["suse.cz", "suse.de"]], "hostname":$["dhcp_hostname":"1", "domain":"suse.cz", "name":"laptop"], "interfaces":$["eth0":$["bootproto":"dhcp4", "mtu":"", "startmode":"auto"], "eth1":$["bootproto":"static", "ipaddr":"1.2.3.4/24", "mtu":"1234", "startmode":"auto"], "eth2":$["bootproto":"static", "ipaddr":"1.2.3.5/24", "mtu":"", "startmode":"auto"], "eth3":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":"", "startmode":"auto"], "eth4":$["bootproto":"static", "ipaddr":"1.2.3.7/24", "mtu":"", "startmode":"auto"]], "routes":$["default":$["via":"10.20.30.40"]]] Modified: trunk/network/testsuite/tests/Network_YaPI.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/testsuite/tests/Network_YaPI.ycp?rev=65483&r1=65482&r2=65483&view=diff ============================================================================== --- trunk/network/testsuite/tests/Network_YaPI.ycp (original) +++ trunk/network/testsuite/tests/Network_YaPI.ycp Wed Aug 31 16:50:56 2011 @@ -35,24 +35,29 @@ ], "value" : $[ "eth0" : $[ + "STARTMODE" : "manual", "BOOTPROTO" : "dhcp4" ], "eth1" : $[ + "STARTMODE" : "auto", "BOOTPROTO" : "static", "IPADDR" : "1.2.3.4/24", "MTU" : "1234", ], "eth2" : $[ + "STARTMODE" : "auto", "BOOTPROTO" : "static", "IPADDR" : "1.2.3.5/24", "PREFIXLEN" : "", ], "eth3" : $[ + "STARTMODE" : "auto", "BOOTPROTO" : "static", "IPADDR" : "1.2.3.6", "PREFIXLEN" : "24", ], "eth4" : $[ + "STARTMODE" : "auto", "BOOTPROTO" : "static", "IPADDR" : "1.2.3.7", "NETMASK" : "255.255.255.0", @@ -75,6 +80,9 @@ TEST(``(YaPI::NETWORK::Write($[])), [$[], $[], $[]], nil); +// test manipulation of the startmode +TEST(``(YaPI::NETWORK::Write($["interface":$["eth0":$["bootproto":"dhcp4", "STARTMODE":"auto"]]])), [READ], nil); + // test correct default route TEST(``(YaPI::NETWORK::Write($["route":$["default":$["via":"10.20.30.40"]]])), [READ], nil); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
mvidner@svn2.opensuse.org