commit yast2-network for openSUSE:Factory
Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2018-11-18 22:59:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-network" Sun Nov 18 22:59:47 2018 rev:394 rq:649204 version:4.1.17 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2018-11-01 19:09:26.250032826 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-network.new/yast2-network.changes 2018-11-18 23:00:42.207633536 +0100 @@ -1,0 +2,14 @@ +Sun Nov 11 16:29:30 UTC 2018 - knut.anderssen@suse.com + +- Yast::Lan: Added method for obtaining the NTP servers offered by + DHCP (fate#323454) +- 4.1.17 + +------------------------------------------------------------------- +Fri Nov 9 16:38:35 UTC 2018 - dgonzalez@suse.com + +- Allow to swich the network backend from the proposal (related to + fate#326480) +- 4.1.16 + +------------------------------------------------------------------- Old: ---- yast2-network-4.1.15.tar.bz2 New: ---- yast2-network-4.1.17.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.0ppILA/_old 2018-11-18 23:00:44.051631472 +0100 +++ /var/tmp/diff_new_pack.0ppILA/_new 2018-11-18 23:00:44.055631467 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.1.15 +Version: 4.1.17 Release: 0 BuildArch: noarch ++++++ yast2-network-4.1.15.tar.bz2 -> yast2-network-4.1.17.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.1.15/package/yast2-network.changes new/yast2-network-4.1.17/package/yast2-network.changes --- old/yast2-network-4.1.15/package/yast2-network.changes 2018-10-31 10:03:07.000000000 +0100 +++ new/yast2-network-4.1.17/package/yast2-network.changes 2018-11-15 09:53:16.000000000 +0100 @@ -1,4 +1,18 @@ ------------------------------------------------------------------- +Sun Nov 11 16:29:30 UTC 2018 - knut.anderssen@suse.com + +- Yast::Lan: Added method for obtaining the NTP servers offered by + DHCP (fate#323454) +- 4.1.17 + +------------------------------------------------------------------- +Fri Nov 9 16:38:35 UTC 2018 - dgonzalez@suse.com + +- Allow to swich the network backend from the proposal (related to + fate#326480) +- 4.1.16 + +------------------------------------------------------------------- Wed Oct 31 08:37:13 UTC 2018 - mfilka@suse.com - bnc#1111925 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.1.15/package/yast2-network.spec new/yast2-network-4.1.17/package/yast2-network.spec --- old/yast2-network-4.1.15/package/yast2-network.spec 2018-10-31 10:03:07.000000000 +0100 +++ new/yast2-network-4.1.17/package/yast2-network.spec 2018-11-15 09:53:16.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 4.1.15 +Version: 4.1.17 Release: 0 BuildArch: noarch diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.1.15/src/lib/network/clients/network_proposal.rb new/yast2-network-4.1.17/src/lib/network/clients/network_proposal.rb --- old/yast2-network-4.1.15/src/lib/network/clients/network_proposal.rb 2018-10-31 10:03:07.000000000 +0100 +++ new/yast2-network-4.1.17/src/lib/network/clients/network_proposal.rb 2018-11-15 09:53:16.000000000 +0100 @@ -1,3 +1,4 @@ +require "cgi" require "installation/proposal_client" module Yast @@ -6,6 +7,11 @@ include Yast::I18n include Yast::Logger + BACKEND_LINKS = [ + SWITCH_TO_WICKED = "network--switch-to-wicked".freeze, + SWITCH_TO_NETWORK_MANAGER = "network--switch-to-nm".freeze + ].freeze + def initialize Yast.import "UI" Yast.import "Lan" @@ -24,24 +30,80 @@ def make_proposal(_) { - "preformatted_proposal" => Yast::Lan.Summary("proposal"), - "label_proposal" => [Yast::LanItems.summary("one_line")] + "preformatted_proposal" => preformatted_proposal, + "label_proposal" => [Yast::LanItems.summary("one_line")], + "links" => BACKEND_LINKS } end def ask_user(args) - log.info "Launching network configuration" - begin - Yast::Wizard.OpenAcceptDialog + result = + case args["chosen_id"] + when "network--switch-to-wicked" + switch_to_wicked + when "network--switch-to-nm" + switch_to_network_manager + else + launch_network_configuration(args) + end + + { "workflow_sequence" => result } + end - result = Yast::WFM.CallFunction("inst_lan", [args.merge("skip_detection" => true)]) + private - log.info "Returning from the network configuration with: #{result}" - ensure - Yast::Wizard.CloseDialog + def preformatted_proposal + proposal_text = switch_backend_link + proposal_text.prepend(Yast::Lan.Summary("proposal")) if wicked_backend? + proposal_text + end + + def switch_backend_link + # TRANSLATORS: information about the network backend in use. %s is the name of backend, + # example "wicked" or "NetworkManager" + backend_in_use = _("Using <b>%s</b>") + # TRANSLATORS: text of link for switch to another network backend. %s is the name of backend, + # example "wicked" or "NetworkManager" + switch_to = _("switch to %s") + + if wicked_backend? + current_backend = "wicked" + link_to_another_backend = Hyperlink(SWITCH_TO_NETWORK_MANAGER, switch_to % "NetworkManager") + else + current_backend = "NetworkManager" + link_to_another_backend = Hyperlink(SWITCH_TO_WICKED, switch_to % "wicked") end - { "workflow_sequence" => result } + "<ul><li>#{backend_in_use % current_backend} (#{link_to_another_backend})</li></ul>" + end + + def launch_network_configuration(args) + log.info "Launching network configuration" + Yast::Wizard.OpenAcceptDialog + result = Yast::WFM.CallFunction("inst_lan", [args.merge("skip_detection" => true)]) + log.info "Returning from the network configuration with: #{result}" + result + ensure + Yast::Wizard.CloseDialog + end + + def switch_to_wicked + Yast::NetworkService.use_wicked + :next + end + + def switch_to_network_manager + Yast::NetworkService.use_network_manager + :next + end + + def wicked_backend? + Yast::NetworkService.wicked? + end + + # TODO: move to HTML.ycp + def Hyperlink(href, text) + Builtins.sformat("%2</a>", href, CGI.escapeHTML(text)) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.1.15/src/modules/Lan.rb new/yast2-network-4.1.17/src/modules/Lan.rb --- old/yast2-network-4.1.15/src/modules/Lan.rb 2018-10-31 10:03:07.000000000 +0100 +++ new/yast2-network-4.1.17/src/modules/Lan.rb 2018-11-15 09:53:16.000000000 +0100 @@ -808,52 +808,6 @@ end end - # Create a textual summary for the general network settings - # proposal (NetworkManager + ipv6) - # @return [rich text, links] - def SummaryGeneral - # header for network summary list - header_nm = _("Network Mode") - - if NetworkService.is_network_manager - href_nm = "lan--nm-disable" - # network mode: the interfaces are controlled by the user - status_nm = _("Interfaces controlled by NetworkManager") - # switch from network manager to wicked - link_nm = Hyperlink(href_nm, _("switch to Wicked")) - else - href_nm = "lan--nm-enable" - # network mode - status_nm = _("Traditional network setup with Wicked") - # switch from wicked to network manager - link_nm = Hyperlink(href_nm, _("switch to NetworkManager")) - end - - if @ipv6 - href_v6 = "ipv6-disable" - # ipv6 support is enabled - status_v6 = _("Support for IPv6 protocol is enabled") - # disable ipv6 support - link_v6 = Hyperlink(href_v6, _("disable")) - else - href_v6 = "ipv6-enable" - # ipv6 support is disabled - status_v6 = _("Support for IPv6 protocol is disabled") - # enable ipv6 support - link_v6 = Hyperlink(href_v6, _("enable")) - end - descr = Builtins.sformat( - "<ul><li>%1: %2 (%3)</li></ul> \n\t\t\t <ul><li>%4 (%5)</li></ul>", - header_nm, - status_nm, - link_nm, - status_v6, - link_v6 - ) - links = [href_nm, href_v6] - [descr, links] - end - # Add a new device # @return true if success def Add @@ -990,6 +944,20 @@ have_br end + # Provides a list with the NTP servers obtained via any of dhcp aware + # interfaces + # + # @note parsing dhcp ntp servers when NetworkManager is in use is not + # supported yet (bsc#798886) + # + # @return [Array<String>] list of ntp servers obtained byg DHCP + def dhcp_ntp_servers + return [] if !NetworkService.isNetworkRunning || Yast::NetworkService.is_network_manager + + ReadWithCacheNoGUI() + Yast::LanItems.dhcp_ntp_servers.values.flatten.uniq + end + publish variable: :ipv6, type: "boolean" publish variable: :AbortFunction, type: "block <boolean>" publish variable: :bond_autoconf_slaves, type: "list <string>" @@ -1005,7 +973,6 @@ publish function: :Import, type: "boolean (map)" publish function: :Export, type: "map ()" publish function: :Summary, type: "list (string)" - publish function: :SummaryGeneral, type: "list ()" publish function: :Add, type: "boolean ()" publish function: :Delete, type: "boolean ()" publish function: :AnyDHCPDevice, type: "boolean ()" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.1.15/test/lan_test.rb new/yast2-network-4.1.17/test/lan_test.rb --- old/yast2-network-4.1.15/test/lan_test.rb 2018-10-31 10:03:07.000000000 +0100 +++ new/yast2-network-4.1.17/test/lan_test.rb 2018-11-15 09:53:16.000000000 +0100 @@ -443,3 +443,49 @@ expect(actual["config"]).to eq(expected_config) end end + +describe "Yast::LanClass#dhcp_ntp_servers" do + subject { Yast::Lan } + let(:running) { true } + let(:nm_enabled) { true } + let(:servers) do + { + "eth0" => ["0.pool.ntp.org", "1.pool.ntp.org"], + "eth1" => ["1.pool.ntp.org", "2.pool.ntp.org"] + } + end + + before do + allow(Yast::NetworkService).to receive(:isNetworkRunning).and_return(running) + allow(Yast::NetworkService).to receive(:is_network_manager).and_return(nm_enabled) + allow(Yast::LanItems).to receive(:dhcp_ntp_servers).and_return(servers) + end + + context "when the network is not running" do + let(:running) { false } + it "returns an empty array" do + expect(subject.dhcp_ntp_servers).to eq([]) + end + end + + context "when NetworkManager is in use" do + let(:nm_enabled) { true } + it "returns an empty array" do + expect(subject.dhcp_ntp_servers).to eq([]) + end + end + + context "when wicked is in use" do + let(:nm_enabled) { false } + + it "reads the current network configuration" do + expect(Yast::Lan).to receive(:ReadWithCacheNoGUI) + subject.dhcp_ntp_servers + end + + it "returns a list of the ntp_servers provided by dhcp " do + expect(subject.dhcp_ntp_servers.sort) + .to eql(["0.pool.ntp.org", "1.pool.ntp.org", "2.pool.ntp.org"]) + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-4.1.15/test/network_proposal_test.rb new/yast2-network-4.1.17/test/network_proposal_test.rb --- old/yast2-network-4.1.15/test/network_proposal_test.rb 2018-10-31 10:03:07.000000000 +0100 +++ new/yast2-network-4.1.17/test/network_proposal_test.rb 2018-11-15 09:53:16.000000000 +0100 @@ -20,27 +20,116 @@ end describe "#make_proposal" do - it "returns a map with 'label_proposal' as an array with one line summary'" do - expect(subject.make_proposal({})["label_proposal"]).to eql(["one_line_summary"]) + let(:using_wicked) { true } + let(:proposal) { subject.make_proposal({}) } + + before do + allow(Yast::NetworkService).to receive(:wicked?).and_return(using_wicked) + end + + it "returns a hash describing the proposal" do + expect(proposal).to include("label_proposal", "preformatted_proposal", "links") end - it "returns a map with 'preformatted_proposal' as an array with the network summary'" do - expect(subject.make_proposal({})["preformatted_proposal"]).to eql("rich_text_summary") + context "when using the wicked backend" do + it "includes the Yast::Lan proposal summary" do + expect(proposal["preformatted_proposal"]).to include("rich_text_summary") + end + + it "includes a link for switch to NetworkManager" do + expect(proposal["preformatted_proposal"]).to match(/.*href.*NetworkManager.*/) + end + + it "does not include a link for switch to wicked" do + expect(proposal["preformatted_proposal"]).to_not match(/.*href.*wicked.*/) + end + end + + context "when using the NetworkManager backend" do + let(:using_wicked) { false } + + it "does not include the Yast::Lan proposal summary" do + expect(proposal["preformatted_proposal"]).to_not include("rich_text_summary") + end + + it "does not include a link for switch to NetworkManager" do + expect(proposal["preformatted_proposal"]).to_not match(/.*href.*NetworkManager.*/) + end + + it "includes a link for switch to wicked" do + expect(proposal["preformatted_proposal"]).to match(/.*href.*wicked.*/) + end end end describe "#ask_user" do - it "launchs the inst_lan client forcing the manual configuration" do - expect(Yast::WFM).to receive(:CallFunction).with("inst_lan", [{ "skip_detection" => true }]) - subject.ask_user({}) + let(:chosen_id) { "" } + let(:args) do + { + "chosen_id" => chosen_id, + "skip_detection" => false + } end - it "returns a map with 'workflow_sequence' as the result of the client output" do + before do allow(Yast::WFM).to receive(:CallFunction) - .with("inst_lan", [{ "skip_detection" => true }]) + .with("inst_lan", anything) .and_return("result") + end + + it "returns a map with 'workflow_sequence' as the result of the client output" do + expect(subject.ask_user(args)).to have_key("workflow_sequence") + end + + context "by default" do + let(:args) { { "chosen_id" => "network" } } + + it "launchs the inst_lan client forcing the manual configuration" do + expect(Yast::WFM).to receive(:CallFunction) + .with("inst_lan", [hash_including("skip_detection" => true)]) + + subject.ask_user(args) + end + + it "returns the result of the client output as 'workflow_sequence'" do + expect(subject.ask_user(args)).to eql("workflow_sequence" => "result") + end + end + + context "when 'chosen_id' is 'network--switch-to-wicked'" do + let(:args) { { "chosen_id" => "network--switch-to-wicked" } } + + it "does not launchs the inst_lan client" do + expect(Yast::WFM).to_not receive(:CallFuntion).with("inst_lan", anything) + end + + it "changes the netwotk backend to wicked" do + expect(Yast::NetworkService).to receive(:use_wicked) + + subject.ask_user(args) + end + + it "returns :next as 'workflow_sequence'" do + expect(subject.ask_user(args)).to include("workflow_sequence" => :next) + end + end + + context "when 'chosen_id' is 'network--switch-to-wicked'" do + let(:args) { { "chosen_id" => "network--switch-to-nm" } } + + it "does not launchs the inst_lan client" do + expect(Yast::WFM).to_not receive(:CallFuntion).with("inst_lan", anything) + end + + it "changes the netwotk backend to NetworkManager" do + expect(Yast::NetworkService).to receive(:use_network_manager) + + subject.ask_user(args) + end - expect(subject.ask_user({})).to eql("workflow_sequence" => "result") + it "returns :next as 'workflow_sequence'" do + expect(subject.ask_user(args)).to include("workflow_sequence" => :next) + end end end end
participants (1)
-
root