Mailinglist Archive: yast-commit (2114 mails)

< Previous Next >
[yast-commit] r58738 - in /branches/tmp/SLE-11-SP1-Stash/network: VERSION package/yast2-network.changes src/lan/Makefile.am src/lan/YaPI/ src/lan/YaPI/NETWORK.pm yast2-network.spec.in
  • From: mzugec@xxxxxxxxxxxxxxxx
  • Date: Thu, 24 Sep 2009 07:46:36 -0000
  • Message-id: <E1Mqj2C-00016k-BK@xxxxxxxxxxxxxxxx>
Author: mzugec
Date: Thu Sep 24 09:46:36 2009
New Revision: 58738

URL: http://svn.opensuse.org/viewcvs/yast?rev=58738&view=rev
Log:
YaPI: backported NETWORK.pm for webYaST

Added:
branches/tmp/SLE-11-SP1-Stash/network/src/lan/YaPI/
branches/tmp/SLE-11-SP1-Stash/network/src/lan/YaPI/NETWORK.pm
Modified:
branches/tmp/SLE-11-SP1-Stash/network/VERSION
branches/tmp/SLE-11-SP1-Stash/network/package/yast2-network.changes
branches/tmp/SLE-11-SP1-Stash/network/src/lan/Makefile.am
branches/tmp/SLE-11-SP1-Stash/network/yast2-network.spec.in

Modified: branches/tmp/SLE-11-SP1-Stash/network/VERSION
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/SLE-11-SP1-Stash/network/VERSION?rev=58738&r1=58737&r2=58738&view=diff
==============================================================================
--- branches/tmp/SLE-11-SP1-Stash/network/VERSION (original)
+++ branches/tmp/SLE-11-SP1-Stash/network/VERSION Thu Sep 24 09:46:36 2009
@@ -1 +1 @@
-2.17.98
+2.17.99

Modified: branches/tmp/SLE-11-SP1-Stash/network/package/yast2-network.changes
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/SLE-11-SP1-Stash/network/package/yast2-network.changes?rev=58738&r1=58737&r2=58738&view=diff
==============================================================================
--- branches/tmp/SLE-11-SP1-Stash/network/package/yast2-network.changes
(original)
+++ branches/tmp/SLE-11-SP1-Stash/network/package/yast2-network.changes Thu Sep
24 09:46:36 2009
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Sep 24 09:42:13 CEST 2009 - mzugec@xxxxxxx
+
+- YaPI: backported NETWORK.pm for webYaST
+- 2.17.99
+
+-------------------------------------------------------------------
Wed Aug 19 10:40:36 CEST 2009 - kmachalkova@xxxxxxx

- Do a proper reload of network service on writing (standalone) DNS

Modified: branches/tmp/SLE-11-SP1-Stash/network/src/lan/Makefile.am
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/SLE-11-SP1-Stash/network/src/lan/Makefile.am?rev=58738&r1=58737&r2=58738&view=diff
==============================================================================
--- branches/tmp/SLE-11-SP1-Stash/network/src/lan/Makefile.am (original)
+++ branches/tmp/SLE-11-SP1-Stash/network/src/lan/Makefile.am Thu Sep 24
09:46:36 2009
@@ -7,4 +7,10 @@
yncludedir = @yncludedir@/network/lan
ynclude_DATA = $(wildcard *.ycp)

-EXTRA_DIST = $(ynclude_DATA)
+YaPI_perldir = @moduledir@/YaPI
+
+YaPI_perl_DATA = \
+ YaPI/NETWORK.pm
+
+
+EXTRA_DIST = $(ynclude_DATA) $(YaPI_perl_DATA)

Added: branches/tmp/SLE-11-SP1-Stash/network/src/lan/YaPI/NETWORK.pm
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/SLE-11-SP1-Stash/network/src/lan/YaPI/NETWORK.pm?rev=58738&view=auto
==============================================================================
--- branches/tmp/SLE-11-SP1-Stash/network/src/lan/YaPI/NETWORK.pm (added)
+++ branches/tmp/SLE-11-SP1-Stash/network/src/lan/YaPI/NETWORK.pm Thu Sep 24
09:46:36 2009
@@ -0,0 +1,137 @@
+package YaPI::NETWORK;
+
+use strict;
+use YaST::YCP qw(:LOGGING);
+use YaPI;
+use Data::Dumper;
+use Switch;
+
+# ------------------- imported modules
+YaST::YCP::Import ("LanItems");
+YaST::YCP::Import ("Hostname");
+YaST::YCP::Import ("DNS");
+YaST::YCP::Import ("Routing");
+# -------------------------------------
+
+our $VERSION = '1.0.0';
+our @CAPABILITIES = ('SLES11');
+our %TYPEINFO;
+
+# TODO: parameter map<string, boolean> what_I_Need
+BEGIN{$TYPEINFO{Read} = ["function",
+ [ "map", "string", "any"]];
+}
+sub Read {
+ my $self = shift;
+
+# Hostname->Read();
+ DNS->Read();
+ Routing->Read();
+ LanItems->Read();
+
+ my %interfaces = ();
+ 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' );
+ %configuration->{'ipaddr'} = LanItems->ipaddr . "/" .
LanItems->prefix;
+ }
+ $interfaces{LanItems->interfacename}=\%configuration;
+ } elsif (LanItems->getCurrentItem()->{'hwinfo'}->{'type'} eq "eth") {
+ $interfaces{%{LanItems->getCurrentItem()}->{"hwinfo"}->{"dev_name"}}=
{};
+ }
+ }
+
+ #FIXME: validate for nil values (dns espacially)
+ my %ret = ('interfaces'=>\%interfaces,
+ 'routes'=>{'default'=>{'via'=>Routing->GetGateway()}},
+ 'dns'=>{'nameservers'=>\@{DNS->nameservers},
'searches'=>\@{DNS->searchlist}},
+ 'hostname'=>{'name'=>Hostname->CurrentHostname,
'domain'=>Hostname->CurrentDomain}
+ );
+ return \%ret;
+}
+
+BEGIN{$TYPEINFO{Write} = ["function",
+ "boolean",["map","string","any"]];
+}
+sub Write {
+ my $self = shift;
+ my $args = shift;
+ y2milestone("YaPI->Write with settings:", Dumper(\$args));
+ # SAVE DEFAULT ROUTE
+ if (exists($args->{'route'})){
+ my $gw="";
+ my $dest="";
+ my @route = ();
+ if (defined ($args->{'route'}->{'default'}->{'via'})){
+ $gw = $args->{'route'}->{'default'}->{'via'};
+ if ($gw ne ""){
+ $dest = "default";
+ @route = ( {"destination" => $dest,
+ "gateway" => $gw,
+ "netmask" => "-",
+ "device" => "-"
+ });
+ }
+ }
+ Routing->Read();
+ y2milestone("YaPI->Write before change Routes:", Dumper(Routing->Routes));
+ Routing->Routes( \@route );
+ y2milestone("YaPI->Write after change Routes:", Dumper(Routing->Routes));
+ Routing->Write();
+ }
+ # SAVE HOSTNAME
+ if (exists($args->{'hostname'})){
+ y2milestone("hostname", Dumper(\$args->{'hostname'}));
+ DNS->Read();
+ DNS->hostname($args->{'hostname'}->{'name'});
+ DNS->domain($args->{'hostname'}->{'domain'});
+ DNS->modified(1);
+ DNS->Write();
+ }
+ # SAVE DNS Settings
+ if (exists($args->{'dns'})){
+ y2milestone("dns", Dumper(\$args->{'dns'}));
+ DNS->Read();
+ DNS->nameservers($args->{'dns'}->{'nameservers'});
+ DNS->searchlist($args->{'dns'}->{'searches'});
+ DNS->modified(1);
+ DNS->Write();
+ }
+ # SAVE DNS Settings
+ if (exists($args->{'interface'})){
+ y2milestone("interface", Dumper(\$args->{'interface'}));
+ foreach my $dev (keys %{$args->{'interface'}}){
+# YaST::YCP::Import ("LanItems");
+# LanItems->Read();
+# foreach my $iface (keys %{LanItems->Items}){
+# LanItems->current($iface);
+# LanItems->DeleteItem();
+# }
+# LanItems->Write();
+ YaST::YCP::Import ("NetworkInterfaces");
+ NetworkInterfaces->Read();
+ NetworkInterfaces->Add() unless NetworkInterfaces->Edit($dev);
+ NetworkInterfaces->Name($dev);
+ my %config=("STARTMODE" => "auto",
+ "BOOTPROTO" =>
$args->{'interface'}->{$dev}->{'bootproto'},
+ "IPADDR" => $args->{'interface'}->{$dev}->{'ipaddr'}
+ );
+ NetworkInterfaces->Current(\%config);
+ NetworkInterfaces->Commit();
+ NetworkInterfaces->Write("");
+ YaST::YCP::Import ("Service");
+ Service->Restart("network");
+ }
+
+ }
+
+ return 1;
+}
+
+1;

Modified: branches/tmp/SLE-11-SP1-Stash/network/yast2-network.spec.in
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/SLE-11-SP1-Stash/network/yast2-network.spec.in?rev=58738&r1=58737&r2=58738&view=diff
==============================================================================
--- branches/tmp/SLE-11-SP1-Stash/network/yast2-network.spec.in (original)
+++ branches/tmp/SLE-11-SP1-Stash/network/yast2-network.spec.in Thu Sep 24
09:46:36 2009
@@ -77,6 +77,7 @@
@clientdir@/*.ycp
@moduledir@/*.ycp
@moduledir@/*.ybc
+@moduledir@/YaPI/NETWORK.pm
@desktopdir@/*.desktop
@scrconfdir@/*.scr
@agentdir@/ag_udev_persistent

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages