[yast-commit] [ci_new_pac] JFYI yast2-registration -> sle12
Script 'mail_helper' called by ro Hello packager, This is just FYI. Your package was checked in in distribution "sle12" by autobuild-member: ro. Here comes the log... ---------------------------%<------------------------------ Hi, here is the log from ci_new_pac /mounts/work_src_done/SLE12/yast2-registration -> sle12 ## BNC# 867120 : "registratin is broken" (RESOLVED/FIXED) Changes: -------- --- /work/SRC/SUSE:SLE-12:GA/yast2-registration/yast2-registration.changes 2014-03-03 17:48:46.000000000 +0100 +++ /mounts/work_src_done/SLE12/yast2-registration/yast2-registration.changes 2014-03-06 16:13:10.000000000 +0100 @@ -1,0 +2,18 @@ +Thu Mar 6 14:18:51 UTC 2014 - lslezak@suse.cz + +- fixed service refresh loop (bnc#867120) +- 3.1.17 + +------------------------------------------------------------------- +Thu Mar 6 12:57:21 UTC 2014 - lslezak@suse.cz + +- fixed crash at start (added missing "require" call) (bnc#867120) +- 3.1.16 + +------------------------------------------------------------------- +Wed Mar 5 07:49:49 UTC 2014 - lslezak@suse.cz + +- added SLP service discovery (FATE#316384) +- 3.1.15 + +------------------------------------------------------------------- calling whatdependson for sle12-i586 Packages directly triggered for rebuild: - yast2-registration ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/SUSE:SLE-12:GA/yast2-registration (Old) and /mounts/work_src_done/SLE12/yast2-registration (BS:build ID:34003 MAIL:yast-commit@opensuse.org) (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-registration", Maintainer is "yast-commit@opensuse.org" Old: ---- yast2-registration-3.1.14.tar.bz2 New: ---- yast2-registration-3.1.17.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-registration.spec ++++++ --- /var/tmp/diff_new_pack.U3Y2DP/_old 2014-03-06 18:56:37.000000000 +0100 +++ /var/tmp/diff_new_pack.U3Y2DP/_new 2014-03-06 18:56:37.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.1.14 +Version: 3.1.17 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-registration-3.1.14.tar.bz2 -> yast2-registration-3.1.17.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.14/package/yast2-registration.changes new/yast2-registration-3.1.17/package/yast2-registration.changes --- old/yast2-registration-3.1.14/package/yast2-registration.changes 2014-03-03 16:14:50.000000000 +0100 +++ new/yast2-registration-3.1.17/package/yast2-registration.changes 2014-03-06 16:10:09.000000000 +0100 @@ -1,4 +1,22 @@ ------------------------------------------------------------------- +Thu Mar 6 14:18:51 UTC 2014 - lslezak@suse.cz + +- fixed service refresh loop (bnc#867120) +- 3.1.17 + +------------------------------------------------------------------- +Thu Mar 6 12:57:21 UTC 2014 - lslezak@suse.cz + +- fixed crash at start (added missing "require" call) (bnc#867120) +- 3.1.16 + +------------------------------------------------------------------- +Wed Mar 5 07:49:49 UTC 2014 - lslezak@suse.cz + +- added SLP service discovery (FATE#316384) +- 3.1.15 + +------------------------------------------------------------------- Mon Mar 3 13:18:11 UTC 2014 - lslezak@suse.cz - allow changing the registration server URL in installation via diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.14/package/yast2-registration.spec new/yast2-registration-3.1.17/package/yast2-registration.spec --- old/yast2-registration-3.1.14/package/yast2-registration.spec 2014-03-03 16:14:50.000000000 +0100 +++ new/yast2-registration-3.1.17/package/yast2-registration.spec 2014-03-06 16:10:09.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.1.14 +Version: 3.1.17 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.14/src/Makefile.am new/yast2-registration-3.1.17/src/Makefile.am --- old/yast2-registration-3.1.14/src/Makefile.am 2014-03-03 16:14:50.000000000 +0100 +++ new/yast2-registration-3.1.17/src/Makefile.am 2014-03-06 16:10:09.000000000 +0100 @@ -1,6 +1,7 @@ # Sources for installation client_DATA = \ + clients/discover_registration_services.rb \ clients/inst_scc.rb \ clients/scc.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.14/src/clients/discover_registration_services.rb new/yast2-registration-3.1.17/src/clients/discover_registration_services.rb --- old/yast2-registration-3.1.14/src/clients/discover_registration_services.rb 2014-03-03 16:14:50.000000000 +0100 +++ new/yast2-registration-3.1.17/src/clients/discover_registration_services.rb 2014-03-06 16:10:09.000000000 +0100 @@ -1,3 +1,6 @@ + +require "registration/helpers" + module Yast import 'SlpService' import 'UI' @@ -23,23 +26,16 @@ textdomain "registration" busy_box do - log.info( - "Searching for SLP registration services of type #{SUPPORTED_SERVICES.join(', ')}" - ) + log.info "Searching for #{SUPPORTED_SERVICES.inspect} SLP services" SUPPORTED_SERVICES.each do |service_name| services.concat(SlpService.all(service_name)) end end - if services.empty? - return Report.Message _('No registration server found') - else - log.info( - "Found #{services.size} services: #{services.map(&:slp_url).join(', ')}" - ) - end + log.debug "Found services: #{services.inspect}" + log.info "Found #{services.size} services: #{services.map(&:slp_url).inspect}" - select_registration_service + services.empty? ? nil : select_registration_service end private @@ -47,71 +43,73 @@ def select_registration_service UI.OpenDialog( Opt(:decorated), - VBox( - Label(_('Available local registration servers')), - VSpacing(0.6), - RadioButtonGroup( - Id(:services), - Left( - HVSquash( - VBox(*services_radio_buttons) + MarginBox(2, 0.5, + VBox( + # popup heading (in bold) + Heading(_('Local Registration Servers')), + VSpacing(0.5), + Label(_("Select a server from the list or press Cancel\n" + + "to use the default SUSE registration server.")), + VSpacing(0.5), + RadioButtonGroup( + Id(:services), + Left( + HVSquash( + VBox(*services_radio_buttons) + ) ) + ), + VSpacing(Opt(:vstretch), 1), + ButtonBox( + PushButton(Id(:ok), Label.OKButton), + PushButton(Id(:cancel), Label.CancelButton) ) - ), - ButtonBox( - PushButton(Id(:ok), Label.OKButton), - PushButton(Id(:cancel), Label.CancelButton) ) ) ) - loop do - dialog_result = UI.UserInput - case dialog_result - when :ok - selected = UI.QueryWidget(Id(:services), :CurrentButton) - if !selected - Report.Error(_('Please select one of the registration servers')) - next + begin + loop do + dialog_result = UI.UserInput + case dialog_result + when :ok + selected = UI.QueryWidget(Id(:services), :CurrentButton) + if !selected + # error popup + Report.Error(_("No registration server selected.")) + next + end + + selected_service = services[selected.to_i] + log.info "Selected service #{selected_service.inspect}" + + url = Registration::Helpers.service_url(selected_service.slp_url) + log.info "Selected service URL: #{url}" + + return url + when :cancel + break end - select_service(services[selected.to_i]) - UI.CloseDialog - break - when :cancel - UI.CloseDialog - break end + ensure + UI.CloseDialog end end - def select_service(service) - log.info("Selected registration service: #{service.inspect}") - #TODO Assign the service to a module or a global object now - end - def services_radio_buttons services.map.with_index do |service, index| Left( RadioButton( Id(index.to_s), - service_description(service), + Registration::Helpers.service_description(service), false ) ) end end - def service_description(service) - name = REGISTRATION_SERVICES[service.name] - url = "#{service.protocol}://#{service.host}:#{service.port} " - attributes = service.attributes.to_h.map do |name, value| - "#{name}=#{value} " - end - "#{name} #{url} #{attributes.join}" - end - def busy_box - Popup.ShowFeedback(_('Searching for registration servers...'), '') + Popup.ShowFeedback(_("Searching..."), _("Looking up local registration servers...")) yield ensure Popup.ClearFeedback diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.14/src/clients/inst_scc.rb new/yast2-registration-3.1.17/src/clients/inst_scc.rb --- old/yast2-registration-3.1.14/src/clients/inst_scc.rb 2014-03-03 16:14:50.000000000 +0100 +++ new/yast2-registration-3.1.17/src/clients/inst_scc.rb 2014-03-06 16:10:09.000000000 +0100 @@ -27,6 +27,7 @@ require "registration/exceptions" require "registration/helpers" +require "registration/sw_mgmt" module Yast class InstSccClient < Client diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.14/src/lib/registration/helpers.rb new/yast2-registration-3.1.17/src/lib/registration/helpers.rb --- old/yast2-registration-3.1.14/src/lib/registration/helpers.rb 2014-03-03 16:14:50.000000000 +0100 +++ new/yast2-registration-3.1.17/src/lib/registration/helpers.rb 2014-03-06 16:10:09.000000000 +0100 @@ -66,12 +66,38 @@ return boot_url if boot_url end - # TODO FIXME: add SLP discovery + # SLP discovery + # TODO FIXME: replace "true" by reading the SLP option from configuration file + if Yast::Mode.installation || true + slp_url = slp_service_url + return slp_url if slp_url + end + + # TODO FIXME: read the URL from configuration file to use the same URL + # at re-registration at installed system # no custom URL, use the default nil end + # convert service URL to plain URL, remove the SLP service prefix + # "service:susemanager:https://scc.suse.com/connect" -> + # "https://scc.suse.com/connect" + def self.service_url(service) + service.sub(/\Aservice:[^:]+:/, "") + end + + # Create radio button label for a SLP service + # @param service [Yast::SlpServiceClass::Service] SLP service + # @return [String] label + def self.service_description(service) + url = Registration::Helpers.service_url(service.slp_url) + descr = service.attributes.to_h[:description] + + # display URL and the description if it is present + (descr && !descr.empty?) ? "#{descr} (#{url})" : url + end + private # return the boot command line parameter @@ -88,5 +114,13 @@ reg_url end + def self.slp_service_url + log.info "Starting SLP discovery..." + url = Yast::WFM.call("discover_registration_services") + log.info "Selected SLP service: #{url.inspect}" + + url + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.14/src/lib/registration/sw_mgmt.rb new/yast2-registration-3.1.17/src/lib/registration/sw_mgmt.rb --- old/yast2-registration-3.1.14/src/lib/registration/sw_mgmt.rb 2014-03-03 16:14:50.000000000 +0100 +++ new/yast2-registration-3.1.17/src/lib/registration/sw_mgmt.rb 2014-03-06 16:10:09.000000000 +0100 @@ -102,9 +102,7 @@ end # services for registered products - services = product_services.map &:services - - services.each do |service| + product_services.map(&:services).flatten.each do |service| log.info "Adding service #{service.name.inspect} (#{service.url})" # progress bar label diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.14/test/discover_registration_services_spec.rb new/yast2-registration-3.1.17/test/discover_registration_services_spec.rb --- old/yast2-registration-3.1.14/test/discover_registration_services_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-3.1.17/test/discover_registration_services_spec.rb 2014-03-06 16:10:09.000000000 +0100 @@ -0,0 +1,62 @@ +#! /usr/bin/env rspec + +require_relative "spec_helper" + +require "yast" + +describe "discover_registration_services client" do + let(:ui) { double("Yast::UI") } + let(:slpservice) { double("Yast::SlpService") } + + before do + # generic UI stubs for the progress dialog + stub_const("Yast::UI", ui) + stub_const("Yast::SlpService", slpservice) + + allow(ui).to receive(:GetDisplayInfo).and_return({}) + allow(ui).to receive(:BusyCursor) + allow(ui).to receive(:NormalCursor) + allow(ui).to receive(:OpenDialog) + allow(ui).to receive(:CloseDialog) + end + + context "when no SLP server is annnounced" do + it "returns nil and does not ask the user" do + expect(slpservice).to receive(:all).and_return([]) + expect(ui).to receive(:UserInput).never + expect(Yast::WFM.call("discover_registration_services")).to be_nil + end + end + + context "when a SLP server is present" do + # mocked announced registration URL via SLP + let(:slp_url) { "https://example.com/register" } + + before do + # stub the SLP service discovery + slp_service = double + slp_attributes = double + allow(slp_attributes).to receive(:to_h).and_return({:description => "Description"}) + allow(slp_service).to receive(:attributes).and_return(slp_attributes) + allow(slp_service).to receive(:slp_url).and_return("service:susemanager:#{slp_url}") + allow(slpservice).to receive(:all).and_return([slp_service]) + end + + it "returns the SLP server selected by user" do + # stub the user interaction in the SLP server selection dialog + expect(ui).to receive(:UserInput).and_return(:ok) + # the first radio button is selected + expect(ui).to receive(:QueryWidget).and_return("0") + + expect(Yast::WFM.call("discover_registration_services")).to eq(slp_url) + end + + it "returns nil when the SLP dialog is canceled" do + # stub the user interaction in the SLP server selection dialog + expect(ui).to receive(:UserInput).and_return(:cancel) + + expect(Yast::WFM.call("discover_registration_services")).to be_nil + end + end + +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.14/test/helpers_spec.rb new/yast2-registration-3.1.17/test/helpers_spec.rb --- old/yast2-registration-3.1.14/test/helpers_spec.rb 2014-03-03 16:14:50.000000000 +0100 +++ new/yast2-registration-3.1.17/test/helpers_spec.rb 2014-03-06 16:10:09.000000000 +0100 @@ -9,36 +9,65 @@ describe ".registration_url" do context "at installation" do before do - expect(Yast::Mode).to receive(:installation).and_return(true) + allow(Yast::Mode).to receive(:installation).and_return(true) end - it "returns 'reg_url' boot parameter from Linuxrc" do - url = "https://example.com/register" - expect(Yast::Linuxrc).to receive(:InstallInf).with("Cmdline").and_return("splash=silent reg_url=#{url} vga=0x314") - expect(Registration::Helpers.registration_url).to eq(url) - end + context "no local registration server is announced via SLP" do + it "returns 'reg_url' boot parameter from Linuxrc" do + url = "https://example.com/register" + expect(Yast::Linuxrc).to receive(:InstallInf).with("Cmdline").and_return("splash=silent reg_url=#{url} vga=0x314") + # make sure no SLP discovery is executed, the boot parameter has higher priority + expect(Yast::WFM).to receive(:call).with("discover_registration_services").never + expect(Registration::Helpers.registration_url).to eq(url) + end + + it "uses the last 'reg_url' boot parameter from Linuxrc" do + url1 = "https://example.com/register" + url2 = "https://foo.org/registration" + expect(Yast::Linuxrc).to receive(:InstallInf).with("Cmdline").and_return("splash=silent reg_url=#{url1} reg_url=#{url2} vga=0x314") + # make sure no SLP discovery is executed, the boot parameter has higher priority + expect(Yast::WFM).to receive(:call).with("discover_registration_services").never + expect(Registration::Helpers.registration_url).to eq(url2) + end + + it "returns nil when no custom URL is required in Linuxrc" do + expect(Yast::Linuxrc).to receive(:InstallInf).with("Cmdline").and_return("splash=silent vga=0x314") + expect(Yast::WFM).to receive(:call).with("discover_registration_services").and_return(nil) + expect(Registration::Helpers.registration_url).to be_nil + end + + it "returns nil when no boot command line is defined in Linuxrc" do + expect(Yast::Linuxrc).to receive(:InstallInf).with("Cmdline").and_return(nil) + expect(Yast::WFM).to receive(:call).with("discover_registration_services").and_return(nil) + expect(Registration::Helpers.registration_url).to be_nil + end + end + + context "no boot parameter is used and a SLP server is announced" do + before do + # no boot parameter passed, it would have higher priority + expect(Yast::Linuxrc).to receive(:InstallInf).with("Cmdline").and_return("splash=silent vga=0x314") + end + + it "returns the SLP server selected by user" do + slp_url = "https://example.com/register" + expect(Yast::WFM).to receive(:call).with("discover_registration_services").and_return(slp_url) + expect(Registration::Helpers.registration_url).to eq(slp_url) + end + + it "returns nil when the SLP dialog is canceled" do + expect(Yast::WFM).to receive(:call).with("discover_registration_services").and_return(nil) + expect(Registration::Helpers.registration_url).to be_nil + end - it "uses the last 'reg_url' boot parameter from Linuxrc" do - url1 = "https://example.com/register" - url2 = "https://foo.org/registration" - expect(Yast::Linuxrc).to receive(:InstallInf).with("Cmdline").and_return("splash=silent reg_url=#{url1} reg_url=#{url2} vga=0x314") - expect(Registration::Helpers.registration_url).to eq(url2) - end - - it "returns nil when no custom URL is required in Linuxrc" do - expect(Yast::Linuxrc).to receive(:InstallInf).with("Cmdline").and_return("splash=silent vga=0x314") - expect(Registration::Helpers.registration_url).to be_nil - end - - it "returns nil when no boot command line is defined in Linuxrc" do - expect(Yast::Linuxrc).to receive(:InstallInf).with("Cmdline").and_return(nil) - expect(Registration::Helpers.registration_url).to be_nil end end context "at installed system" do before do - expect(Yast::Mode).to receive(:installation).and_return(false) + allow(Yast::Mode).to receive(:installation).and_return(false) + # FIXME: stub SLP service discovery, later add config file reading + expect(Yast::WFM).to receive(:call).with("discover_registration_services").and_return(nil) end it "ignores Linuxrc boot parameters" do @@ -49,4 +78,34 @@ end end + describe ".service_url" do + it "converts a SLP service to plain URL" do + url = "https://example.com/registration" + service = "service:susemanager:#{url}" + expect(Registration::Helpers.service_url(service)).to eq(url) + end + end + + describe ".service_description" do + let(:slp_url) { "https://example.com/registration" } + let(:slp_attributes) { double } + let(:slp_service) { double } + + before do + expect(slp_service).to receive(:attributes).and_return(slp_attributes) + expect(slp_service).to receive(:slp_url).and_return("service:susemanager:#{slp_url}") + end + + it "creates a label with description and url" do + description = "Description" + expect(slp_attributes).to receive(:to_h).and_return({:description => description}) + expect(Registration::Helpers.service_description(slp_service)).to eq("#{description} (#{slp_url})") + end + + it "creates a label with url only when description is missing" do + expect(slp_attributes).to receive(:to_h).and_return({}) + expect(Registration::Helpers.service_description(slp_service)).to eq(slp_url) + end + end + end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.14/test/spec_helper.rb new/yast2-registration-3.1.17/test/spec_helper.rb --- old/yast2-registration-3.1.14/test/spec_helper.rb 2014-03-03 16:14:50.000000000 +0100 +++ new/yast2-registration-3.1.17/test/spec_helper.rb 2014-03-06 16:10:09.000000000 +0100 @@ -4,3 +4,5 @@ end $:.unshift(File.expand_path("../../src/lib", __FILE__)) + +ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) continue with "q"... Checked in at Thu Mar 6 18:56:48 CET 2014 by ro Remember to have fun... -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
ro