Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2013-12-16 16:47:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2013-12-13 12:01:30.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2013-12-16 18:11:24.000000000 +0100 @@ -1,0 +2,6 @@ +Thu Dec 12 13:14:11 UTC 2013 - mfi...@suse.com + +- changed API for querying network configuration backend +- 3.1.11 + +------------------------------------------------------------------- Old: ---- yast2-3.1.10.tar.bz2 New: ---- yast2-3.1.11.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.DZLDI9/_old 2013-12-16 18:11:24.000000000 +0100 +++ /var/tmp/diff_new_pack.DZLDI9/_new 2013-12-16 18:11:24.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.1.10 +Version: 3.1.11 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-3.1.10.tar.bz2 -> yast2-3.1.11.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.10/library/network/src/modules/NetworkService.rb new/yast2-3.1.11/library/network/src/modules/NetworkService.rb --- old/yast2-3.1.10/library/network/src/modules/NetworkService.rb 2013-12-12 11:02:33.000000000 +0100 +++ new/yast2-3.1.11/library/network/src/modules/NetworkService.rb 2013-12-16 10:32:15.000000000 +0100 @@ -47,24 +47,38 @@ module Yast class NetworkServiceClass < Module - def main + # @current_name - current network backend identification + # @cached_name - the new network backend identification + + # network backend identification to service name mapping + BACKENDS = { + # <internal-id> <service name> + :netconfig => "network", + :network_manager => "NetworkManager", + :wicked => "wicked" + } + + # network backend identification to its rpm package name mapping + BACKEND_PKG_NAMES = { + # <internal-id> <service name> + :netconfig => "sysconfig-network", + :network_manager => "NetworkManager", + :wicked => "wicked" + } + + def main Yast.import "Service" Yast.import "NetworkConfig" Yast.import "Popup" Yast.import "Mode" + Yast.import "PackageSystem" textdomain "base" # if false, read needs to do work @initialized = false - # current network service id name - @cur_service_id_name = "" - - # the new network service id name - @new_service_id_name = "" - # Path to the systemctl command @systemctl = "/bin/systemctl" @@ -89,30 +103,56 @@ # Whether a network service change were requested # @return true when service change were requested def Modified - ret = false Read() - ret = true if @new_service_id_name != @cur_service_id_name - Builtins.y2debug( - "NetworkService::Modified(%1, %2) => %3", - @cur_service_id_name, - @new_service_id_name, - ret - ) - ret + @cached_name != @current_name + end + + # Checks if given network backend is available in the system + def backend_available?(backend) + PackageSystem.Installed( BACKEND_PKG_NAMES[backend]) + end + + alias_method :is_backend_available, :backend_available? + + # Checks if configuration is managed by NetworkManager + # + # @return true when the network is managed by an external tool, + # like NetworkManager, false otherwise + def network_manager? + cached_name == :network_manager + end + + alias_method :is_network_manager, :network_manager? + + def netconfig? + cached_name == :netconfig + end + + alias_method :is_netconfig, :netconfig? + + def wicked? + cached_name == :wicked + end + + alias_method :is_wicked, :wicked? + + def use_network_manager + Read() + @cached_name = :network_manager + + nil end - # Whether use NetworkManager or ifup - # @return true when the network is managed, false when - # the /etc/init.d/network script is in use. - def IsManaged + def use_netconfig Read() - @new_service_id_name != "network" + @cached_name = :netconfig + + nil end - # @param [Boolean] m whether networkmanager will be used - def SetManaged(m) + def use_wicked Read() - @new_service_id_name = m ? "NetworkManager" : "network" + @cached_name = :wicked nil end @@ -120,27 +160,24 @@ # Initialize module data def Read if !@initialized - @cur_service_id_name = Service.GetServiceId("network") - @new_service_id_name = @cur_service_id_name + case Service.GetServiceId("network") + when "network" + @current_name = :netconfig + when "NetworkManager" + @current_name = :network_manager + when "wicked" + @current_name = :wicked + end + + @cached_name = @current_name - nm = @new_service_id_name != "network" - Builtins.y2milestone("NetworkManager: %1", nm) + Builtins.y2milestone("Current backend: #{@current_name}") end @initialized = true nil end - # Enables and disables the appropriate services. - def EnableDisable - # Workaround for bug #61055: - Builtins.y2milestone("Enabling service %1", "network") - cmd = "cd /; /sbin/insserv -d /etc/init.d/network" - SCR.Execute(path(".target.bash"), cmd) - - nil - end - # Run /etc/init.d script with specified action # @param script name of the init script # @param action the action to use @@ -161,15 +198,22 @@ # no effect. # So let's kill all processes in the network service # cgroup to make sure e.g. dhcp clients are stopped. - RunSystemCtl(@cur_service_id_name, "kill") + @initialized = false + RunSystemCtl( BACKENDS[ @current_name], "kill") - if @new_service_id_name == "network" - RunSystemCtl(@cur_service_id_name, "disable") - else - RunSystemCtl(@new_service_id_name, "--force enable") + case @cached_name + when :network_manager, :wicked + RunSystemCtl( BACKENDS[ @cached_name], "--force enable") + when :netconfig + RunSystemCtl( BACKENDS[ @current_name], "disable") + + # Workaround for bug #61055: + Builtins.y2milestone("Enabling service %1", "network") + cmd = "cd /; /sbin/insserv -d /etc/init.d/network" + SCR.Execute(path(".target.bash"), cmd) end - @cur_service_id_name = Service.GetServiceId("network") - @new_service_id_name = @cur_service_id_name + + Read() end nil @@ -228,7 +272,7 @@ # # @return [Boolean] continue def ConfirmNetworkManager - if !@already_asked_for_NetworkManager && IsManaged() + if !@already_asked_for_NetworkManager && network_manager? # TRANSLATORS: pop-up question when reading the service configuration cont = Popup.ContinueCancel( _( @@ -308,11 +352,29 @@ end end + # Replies with currently selected network service name + # + # Currently known backends: + # - :network_manager - not supported by YaST + # - :netconfig - supported + # - :wicked - supported (via its backward compatibility to + # ifup) + # + private + def cached_name + Read() + return @cached_name + end + publish :function => :Read, :type => "void ()" publish :function => :Modified, :type => "boolean ()" - publish :function => :IsManaged, :type => "boolean ()" - publish :function => :SetManaged, :type => "void (boolean)" - publish :function => :EnableDisable, :type => "void ()" + publish :function => :is_backend_available, :type => "boolean (symbol)" + publish :function => :is_network_manager, :type => "boolean ()" + publish :function => :is_netconfig, :type => "boolean ()" + publish :function => :is_wicked, :type => "boolean ()" + publish :function => :use_network_manager, :type => "void ()" + publish :function => :use_netconfig, :type => "void ()" + publish :function => :use_wicked, :type => "void ()" publish :function => :IsActive, :type => "boolean ()" publish :function => :ReloadOrRestart, :type => "void ()" publish :function => :Restart, :type => "void ()" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.10/library/network/test/Makefile.am new/yast2-3.1.11/library/network/test/Makefile.am --- old/yast2-3.1.10/library/network/test/Makefile.am 2013-12-12 11:02:33.000000000 +0100 +++ new/yast2-3.1.11/library/network/test/Makefile.am 2013-12-16 10:32:15.000000000 +0100 @@ -1,6 +1,7 @@ TESTS = \ load_ipv6_cfg_test.rb \ - network_interfaces_helpers_test.rb + network_interfaces_helpers_test.rb \ + network_service_test.rb TEST_EXTENSIONS = .rb RB_LOG_COMPILER = rspec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.10/library/network/test/network_service_test.rb new/yast2-3.1.11/library/network/test/network_service_test.rb --- old/yast2-3.1.10/library/network/test/network_service_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.11/library/network/test/network_service_test.rb 2013-12-16 10:32:15.000000000 +0100 @@ -0,0 +1,19 @@ +#! /usr/bin/env rspec + +inc_dirs = Dir.glob("../../../library/*/src") +inc_dirs.map { |inc_dir| File.expand_path(inc_dir, __FILE__) } +ENV["Y2DIR"] = inc_dirs.join(":") + +require "yast" + +Yast.import "NetworkService" + +describe Yast::NetworkService do + context "smoke test" do + describe "#is_network_manager" do + it "does not crash" do + expect([true, false].include? Yast::NetworkService.is_network_manager).to be_true + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.10/package/yast2.changes new/yast2-3.1.11/package/yast2.changes --- old/yast2-3.1.10/package/yast2.changes 2013-12-12 11:02:33.000000000 +0100 +++ new/yast2-3.1.11/package/yast2.changes 2013-12-16 10:32:15.000000000 +0100 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Dec 12 13:14:11 UTC 2013 - mfi...@suse.com + +- changed API for querying network configuration backend +- 3.1.11 + +------------------------------------------------------------------- Tue Dec 10 11:40:46 UTC 2013 - mfi...@suse.com - bnc#851769 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.10/package/yast2.spec new/yast2-3.1.11/package/yast2.spec --- old/yast2-3.1.10/package/yast2.spec 2013-12-12 11:02:33.000000000 +0100 +++ new/yast2-3.1.11/package/yast2.spec 2013-12-16 10:32:15.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.1.10 +Version: 3.1.11 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org