Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2019-03-10 09:30:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2" Sun Mar 10 09:30:15 2019 rev:446 rq:682763 version:4.1.61 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2019-03-06 19:03:15.957076892 +0100 +++ /work/SRC/openSUSE:Factory/.yast2.new.28833/yast2.changes 2019-03-10 09:30:18.772251224 +0100 @@ -1,0 +2,8 @@ +Fri Mar 8 08:15:47 UTC 2019 - Michal Filka <[email protected]> + +- bnc#1127798 + - do not crash with internal error when enabling a network + network service when no network service is active. +- 4.1.61 + +------------------------------------------------------------------- @@ -4 +12,2 @@ -- added "Modify" button label (related to gh#yast/yast-yast2#713) +- added "Modify" button label (related to bsc#1128279, or just as + good gh#yast/yast-yast2#713) Old: ---- yast2-4.1.60.tar.bz2 New: ---- yast2-4.1.61.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.uCF1eJ/_old 2019-03-10 09:30:20.508250789 +0100 +++ /var/tmp/diff_new_pack.uCF1eJ/_new 2019-03-10 09:30:20.532250783 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 4.1.60 +Version: 4.1.61 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0-only ++++++ yast2-4.1.60.tar.bz2 -> yast2-4.1.61.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.1.60/library/network/src/modules/NetworkService.rb new/yast2-4.1.61/library/network/src/modules/NetworkService.rb --- old/yast2-4.1.60/library/network/src/modules/NetworkService.rb 2019-03-06 12:35:40.000000000 +0100 +++ new/yast2-4.1.61/library/network/src/modules/NetworkService.rb 2019-03-08 12:14:26.000000000 +0100 @@ -47,8 +47,10 @@ module Yast class NetworkServiceClass < Module - # @current_name - current network backend identification - # @cached_name - the new network backend identification + # return [String, nil] current network backend identification, nil is valid value for "no service selected / running" + attr_accessor :current_name + # return [String, nil] new network backend identification, nil is valid value for "no service selected / running" + attr_accessor :cached_name # network backend identification to service name mapping BACKENDS = { @@ -93,6 +95,7 @@ # @param force [Boolean] if action should be forced # @return exit code def RunSystemCtl(service, action, force: false) + raise ArgumentError, "No network service defined." if service.nil? cmd = "/usr/bin/systemctl "\ "#{force ? "--force" : ""} " \ "#{action.shellescape} " \ @@ -208,10 +211,12 @@ def EnableDisableNow return if !Modified() - stop_service(@current_name) - disable_service(@current_name) + if current_name + stop_service(current_name) + disable_service(current_name) + end - RunSystemCtl(BACKENDS[@cached_name], "enable", force: true) + RunSystemCtl(BACKENDS[cached_name], "enable", force: true) if cached_name @initialized = false Read() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.1.60/library/network/test/network_service_test.rb new/yast2-4.1.61/library/network/test/network_service_test.rb --- old/yast2-4.1.60/library/network/test/network_service_test.rb 2019-03-06 12:35:40.000000000 +0100 +++ new/yast2-4.1.61/library/network/test/network_service_test.rb 2019-03-08 12:14:26.000000000 +0100 @@ -23,6 +23,13 @@ expect { Yast::NetworkService.is_netconfig }.not_to raise_error end end + + describe "#EnableDisableNow" do + it "does not crash when current / cached service is nil" do + allow(Yast::NetworkService).to receive(:Modified).and_return(true) + expect { Yast::NetworkService.EnableDisableNow }.not_to raise_error ArgumentError + end + end end describe "#RunSystemCtl" do @@ -39,5 +46,56 @@ subject.RunSystemCtl("wicked", "disable | evil") end + + it "raises an exception when no service name is provided" do + expect { Yast::NetworkService.RunSystemCtl(nil, "enable") }.to raise_error + end + end + + describe "#EnableDisableNow" do + subject { Yast::NetworkService } + + before(:each) do + expect(subject).to receive(:Modified).and_return(true) + end + + context "When changing running service" do + before(:each) do + allow(subject).to receive(:current_name).and_return(:netconfig) + + # using anything instead of exact service name because of some magic in identifying the service in the system + expect(subject).to receive(:RunSystemCtl).with(anything, /stop|kill/) + expect(subject).to receive(:RunSystemCtl).with("network", "disable") + end + + it "disables old service and enables new one" do + allow(subject).to receive(:cached_name).and_return(:wicked) + + expect(subject).to receive(:RunSystemCtl).with("wicked", "enable", any_args) + + subject.EnableDisableNow + end + + it "only disables old service when no network service was requested" do + allow(subject).to receive(:cached_name).and_return(nil) + + expect(subject).not_to receive(:RunSystemCtl).with("wicked", "enable", any_args) + + subject.EnableDisableNow + end + end + + context "When activating a service if none is running" do + before(:each) do + allow(subject).to receive(:current_name).and_return(nil) + allow(subject).to receive(:cached_name).and_return(:wicked) + end + + it "activates new service" do + expect(subject).to receive(:RunSystemCtl).with("wicked", "enable", any_args) + + subject.EnableDisableNow + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.1.60/library/systemd/src/lib/yast2/service_widget.rb new/yast2-4.1.61/library/systemd/src/lib/yast2/service_widget.rb --- old/yast2-4.1.60/library/systemd/src/lib/yast2/service_widget.rb 2019-03-06 12:35:40.000000000 +0100 +++ new/yast2-4.1.61/library/systemd/src/lib/yast2/service_widget.rb 2019-03-08 12:14:26.000000000 +0100 @@ -128,15 +128,16 @@ # # @return [String] def help - helptext = "<h2>Service configuration</h2>" + # TRANSLATORS: helptext for the service current status, the header + helptext = _("<h2>Service configuration</h2>") # TRANSLATORS: helptext for the service current status - helptext << _( + helptext += _( "<h3>Current status</h3>" \ "Displays the curren status of the service." ) # TRANSLATORS: helptext for the "After writting configuration" service widget option - helptext << _( + helptext += _( "<h3>After writing configuration</h3>" \ "Allow to change the service status immediately after accepting the changes. Available options depend on the current state. The <b>Keep current state</b> special action leaves the @@ -144,7 +145,7 @@ ) # TRANSLATORS: helptext for the "After reboot" service widget option - helptext << _( + helptext + _( "<h3>After reboot</h3>" \ "Let choose if service should be started automatically on boot. Some services could be configured <b>on demand</b>, which means that the associated socket will be running and diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.1.60/package/yast2.changes new/yast2-4.1.61/package/yast2.changes --- old/yast2-4.1.60/package/yast2.changes 2019-03-06 12:35:40.000000000 +0100 +++ new/yast2-4.1.61/package/yast2.changes 2019-03-08 12:14:26.000000000 +0100 @@ -1,7 +1,16 @@ ------------------------------------------------------------------- +Fri Mar 8 08:15:47 UTC 2019 - Michal Filka <[email protected]> + +- bnc#1127798 + - do not crash with internal error when enabling a network + network service when no network service is active. +- 4.1.61 + +------------------------------------------------------------------- Wed Mar 06 12:09:35 CET 2019 - [email protected] -- added "Modify" button label (related to gh#yast/yast-yast2#713) +- added "Modify" button label (related to bsc#1128279, or just as + good gh#yast/yast-yast2#713) - 4.1.60 ------------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.1.60/package/yast2.spec new/yast2-4.1.61/package/yast2.spec --- old/yast2-4.1.60/package/yast2.spec 2019-03-06 12:35:40.000000000 +0100 +++ new/yast2-4.1.61/package/yast2.spec 2019-03-08 12:14:26.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 4.1.60 +Version: 4.1.61 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0-only
