[yast-commit] [ci_new_pac] JFYI yast2-registration -> sle12
![](https://seccdn.libravatar.org/avatar/af626ca29b1318211e3f416634b5db76.jpg?s=120&d=mm&r=g)
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# 892449 : "Build0688: YaST does not store registration settings in profile" (RESOLVED/FIXED) ## BNC# 892747 : "Registration: [Back]/[Next] buttons in installer are hidden in Text Mode" (RESOLVED/FIXED) ## BNC# 886662 : ""Abort" button aborts the installation without confirmation" (NEW/) ## BNC# 889503 : "[upgrade] from sled11 sp3 to sled12, SMT registration upgrade failed when using old SMT server" (RESOLVED/FIXED) Changes: -------- --- /work/SRC/SUSE:SLE-12:GA/yast2-registration/yast2-registration.changes 2014-08-18 16:30:39.000000000 +0200 +++ /mounts/work_src_done/SLE12/yast2-registration/yast2-registration.changes 2014-08-22 11:33:32.000000000 +0200 @@ -1,0 +2,23 @@ +Thu Aug 21 09:41:10 UTC 2014 - lslezak@suse.cz + +- save the registration settings to autoinst.xml at the end of + installation (bnc#892449) +- decrease vertical spacing in text mode to fit 80x25 screen + (bnc#892747) +- 3.1.108 + +------------------------------------------------------------------- +Thu Aug 21 11:07:07 CEST 2014 - locilka@suse.com + +- Fixed aborting from the base product registration dialog in + installation - it needs user confirmation now (bnc#886662) +- 3.1.107 + +------------------------------------------------------------------- +Tue Aug 19 14:17:23 UTC 2014 - lslezak@suse.cz + +- check for old SMT server API when registration fails, display + error about outdated SMT server (bnc#889503) +- 3.1.106 + +------------------------------------------------------------------- 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:43027 MAIL:yast-commit@opensuse.org) (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-registration", Maintainer is "yast-commit@opensuse.org" Old: ---- yast2-registration-3.1.105.tar.bz2 New: ---- yast2-registration-3.1.108.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-registration.spec ++++++ --- /var/tmp/diff_new_pack.GSNGpA/_old 2014-08-22 15:44:01.000000000 +0200 +++ /var/tmp/diff_new_pack.GSNGpA/_new 2014-08-22 15:44:01.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.1.105 +Version: 3.1.108 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-registration-3.1.105.tar.bz2 -> yast2-registration-3.1.108.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/package/yast2-registration.changes new/yast2-registration-3.1.108/package/yast2-registration.changes --- old/yast2-registration-3.1.105/package/yast2-registration.changes 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/package/yast2-registration.changes 2014-08-22 11:29:46.000000000 +0200 @@ -1,4 +1,27 @@ ------------------------------------------------------------------- +Thu Aug 21 09:41:10 UTC 2014 - lslezak@suse.cz + +- save the registration settings to autoinst.xml at the end of + installation (bnc#892449) +- decrease vertical spacing in text mode to fit 80x25 screen + (bnc#892747) +- 3.1.108 + +------------------------------------------------------------------- +Thu Aug 21 11:07:07 CEST 2014 - locilka@suse.com + +- Fixed aborting from the base product registration dialog in + installation - it needs user confirmation now (bnc#886662) +- 3.1.107 + +------------------------------------------------------------------- +Tue Aug 19 14:17:23 UTC 2014 - lslezak@suse.cz + +- check for old SMT server API when registration fails, display + error about outdated SMT server (bnc#889503) +- 3.1.106 + +------------------------------------------------------------------- Mon Aug 18 13:34:05 UTC 2014 - lslezak@suse.cz - allow starting the module directly at the extension selection diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/package/yast2-registration.spec new/yast2-registration-3.1.108/package/yast2-registration.spec --- old/yast2-registration-3.1.105/package/yast2-registration.spec 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/package/yast2-registration.spec 2014-08-22 11:29:46.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.1.105 +Version: 3.1.108 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/clients/discover_registration_services.rb new/yast2-registration-3.1.108/src/clients/discover_registration_services.rb --- old/yast2-registration-3.1.105/src/clients/discover_registration_services.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/clients/discover_registration_services.rb 2014-08-22 11:29:46.000000000 +0200 @@ -26,59 +26,71 @@ private - def select_registration_service - UI.OpenDialog( - Opt(:decorated), - MarginBox(2, 0.5, - VBox( - # popup heading (in bold) - Heading(_('Local Registration Servers')), - VSpacing(0.5), - Label(_("Select a detected registration server from the list\n" + - "or the default SUSE registration server.")), - VSpacing(0.5), - RadioButtonGroup( - Id(:services), - Left( - HVSquash( - VBox(*services_radio_buttons) - ) + def button_box + ButtonBox( + PushButton(Id(:ok), Opt(:default), Label.OKButton), + PushButton(Id(:cancel), Label.CancelButton) + ) + end + + def dialog_content + MarginBox(2, 0.5, + VBox( + # popup heading (in bold) + Heading(_('Local Registration Servers')), + VSpacing(0.5), + Label(_("Select a detected registration server from the list\n" + + "or 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), Opt(:default), Label.OKButton), - PushButton(Id(:cancel), Label.CancelButton) ) - ) + ), + VSpacing(Opt(:vstretch), 1), + button_box ) ) + end - 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 - - break if selected == "scc" - - selected_service = services[selected.to_i] - log.info "Selected service #{selected_service.inspect}" - - url = ::Registration::UrlHelpers.service_url(selected_service.slp_url) - log.info "Selected service URL: #{url}" - - return url - when :cancel - return :cancel + def handle_dialog + loop do + case UI.UserInput + when :ok + selected = UI.QueryWidget(Id(:services), :CurrentButton) + if !selected + # error popup + Report.Error(_("No registration server selected.")) + next end + + break if selected == "scc" + + return service_url(selected) + when :cancel + return :cancel end + end + end + + def service_url(selected) + selected_service = services[selected.to_i] + log.info "Selected service #{selected_service.inspect}" + + url = ::Registration::UrlHelpers.service_url(selected_service.slp_url) + log.info "Selected service URL: #{url}" + + return url + end + + def select_registration_service + UI.OpenDialog(Opt(:decorated), dialog_content) + + begin + return handle_dialog ensure UI.CloseDialog end @@ -96,9 +108,9 @@ end widgets.unshift(Left(RadioButton(Id("scc"), - # %s is the default SCC URL - _("SUSE Customer Center (%s)") % SUSE::Connect::Client::DEFAULT_URL, - true))) + # %s is the default SCC URL + _("SUSE Customer Center (%s)") % SUSE::Connect::Client::DEFAULT_URL, + true))) end end unless defined?(DiscoverRegistrationServicesClient) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/clients/inst_scc.rb new/yast2-registration-3.1.108/src/clients/inst_scc.rb --- old/yast2-registration-3.1.105/src/clients/inst_scc.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/clients/inst_scc.rb 2014-08-22 11:29:46.000000000 +0200 @@ -182,6 +182,8 @@ ::Registration::UrlHelpers::reset_registration_url ::Registration::Helpers.reset_registration_status end + when :abort + ret = nil unless Popup.ConfirmAbort(:painless) end if ret == :skip && confirm_skipping @@ -323,14 +325,14 @@ HSquash( VBox( MinWidth(REG_CODE_WIDTH, InputField(Id(:email), _("&E-mail Address"), options.email)), - VSpacing(0.5), + VSpacing(UI.TextMode ? 0 : 0.5), MinWidth(REG_CODE_WIDTH, InputField(Id(:reg_code), _("Registration &Code"), options.reg_code)) ) ), - VSpacing(1), + VSpacing(UI.TextMode ? 0 : 1), # button label PushButton(Id(:local_server), _("&Local Registration Server...")), - VSpacing(UI.TextMode ? 1 : 3), + VSpacing(UI.TextMode ? 0 : 3), # button label registered ? Empty() : PushButton(Id(:skip), _("&Skip Registration")), VStretch() @@ -576,6 +578,17 @@ ::Registration::UI::AddonEulaDialog.run(@selected_addons) end + def update_autoyast_config + options = ::Registration::Storage::InstallationOptions.instance + return :next unless Mode.installation && options.base_registered + + log.info "Updating Autoyast config" + config = ::Registration::Storage::Config.instance + config.import(::Registration::Helpers.collect_autoyast_config(@known_reg_codes)) + config.modified = true + :next + end + # UI workflow definition def start_workflow aliases = { @@ -585,7 +598,8 @@ "select_addons" => lambda { select_addons() }, "update" => [ lambda { update_registration() }, true ], "addon_eula" => lambda { addon_eula() }, - "register_addons" => lambda { register_addons() } + "register_addons" => lambda { register_addons() }, + "update_autoyast_config" => lambda { update_autoyast_config() } } sequence = { @@ -622,6 +636,9 @@ }, "register_addons" => { :abort => :abort, + :next => "update_autoyast_config" + }, + "update_autoyast_config" => { :next => :next } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/desktop/customer_center.desktop new/yast2-registration-3.1.108/src/desktop/customer_center.desktop --- old/yast2-registration-3.1.105/src/desktop/customer_center.desktop 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/desktop/customer_center.desktop 2014-08-22 11:29:46.000000000 +0200 @@ -7,7 +7,7 @@ X-SuSE-YaST-RootOnly=false X-SuSE-YaST-Group=Support X-SuSE-YaST-AutoInst=configure -X-SuSE-YaST-AutoInstClonable=false +X-SuSE-YaST-AutoInstClonable=true X-SuSE-YaST-AutoInstRequires=lan,proxy X-SuSE-YaST-AutoInstSchema=registration.rnc X-SuSE-YaST-AutoInstResource=suse_register diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/lib/registration/addon.rb new/yast2-registration-3.1.108/src/lib/registration/addon.rb --- old/yast2-registration-3.1.105/src/lib/registration/addon.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/lib/registration/addon.rb 2014-08-22 11:29:46.000000000 +0200 @@ -131,6 +131,19 @@ return true end + # Convert to a Hash, exports only the basic Addon properties + # @param [Boolean] release_type_string if true the "release_type" atribute + # will be always a String (nil will be converted to "nil") + # @return [Hash] Hash with basic Addon properties + def to_h(release_type_string: false) + { + "name" => identifier, + "arch" => arch, + "version" => version, + "release_type" => (release_type.nil? && release_type_string) ? "nil" : release_type + } + end + # is the addon available? SMT may have mirrored only some extensions, # the not mirrored extensions are marked as not available # @return [Boolean] true if the addon is available to register diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/lib/registration/connect_helpers.rb new/yast2-registration-3.1.108/src/lib/registration/connect_helpers.rb --- old/yast2-registration-3.1.105/src/lib/registration/connect_helpers.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/lib/registration/connect_helpers.rb 2014-08-22 11:29:46.000000000 +0200 @@ -27,6 +27,7 @@ require "registration/helpers" require "registration/exceptions" require "registration/storage" +require "registration/smt_status" require "registration/ssl_certificate" require "registration/ssl_certificate_details" require "registration/url_helpers" @@ -108,6 +109,11 @@ end report_error(message_prefix + _("Registration failed."), e) + when 404 + # update the message when an old SMT server is found + check_smt_api(e) + + report_error(message_prefix + _("Registration failed."), e) when 422 # Error popup report_error(message_prefix + _("Registration failed."), e) @@ -162,6 +168,11 @@ end false + rescue JSON::ParserError => e + # update the message when an old SMT server is found + check_smt_api(e) + + report_error(message_prefix + _("Registration failed."), e) rescue Exception => e log.error("SCC registration failed: #{e.class}: #{e}, #{e.backtrace}") Yast::Report.Error(error_with_details(_("Registration failed."), e.message)) @@ -212,6 +223,8 @@ cert.import_to_system end + # remember the imported certificate fingerprint for Autoyast export + Storage::InstallationOptions.instance.imported_cert_sha256_fingerprint = cert.sha256_fingerprint log.info "Certificate import result: #{result}" true end @@ -229,6 +242,28 @@ ) end + def self.check_smt_api(e) + url = UrlHelpers.registration_url + # no SMT/custom server used + return if url.nil? + + # test old SMT instance + smt_status = SmtStatus.new(url, insecure: Helpers.insecure_registration) + return unless smt_status.ncc_api_present? + + # display just the hostname in the server URL + display_url = URI(url) + display_url.path = "" + display_url.query = nil + # TRANSLATORS: error message, %s is a server URL, + # e.g. https://smt.example.com + msg = _("An old registration server was detected at\n%s.\n" \ + "Make sure the latest product supporting the new registration\n" \ + "protocol is installed at the server.") % display_url + + e.message.replace(msg) + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/lib/registration/downloader.rb new/yast2-registration-3.1.108/src/lib/registration/downloader.rb --- old/yast2-registration-3.1.105/src/lib/registration/downloader.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/lib/registration/downloader.rb 2014-08-22 11:29:46.000000000 +0200 @@ -26,6 +26,7 @@ require "net/http" require "uri" require "openssl" +require "registration/exceptions" module Registration @@ -69,7 +70,7 @@ download_file(location, insecure: insecure, redirection_count: redirection_count - 1) else log.error "HTTP request failed: Error #{response.code}:#{response.message}: #{response.body}" - raise "Downloading #{file_url} failed: #{response.message}" + raise DownloadError, "Downloading #{file_url} failed: #{response.message}" end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/lib/registration/exceptions.rb new/yast2-registration-3.1.108/src/lib/registration/exceptions.rb --- old/yast2-registration-3.1.105/src/lib/registration/exceptions.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/lib/registration/exceptions.rb 2014-08-22 11:29:46.000000000 +0200 @@ -33,4 +33,7 @@ @service = service end end + + class DownloadError < RuntimeError + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/lib/registration/helpers.rb new/yast2-registration-3.1.108/src/lib/registration/helpers.rb --- old/yast2-registration-3.1.105/src/lib/registration/helpers.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/lib/registration/helpers.rb 2014-08-22 11:29:46.000000000 +0200 @@ -24,7 +24,9 @@ require "yast" require "erb" +require "registration/addon" require "registration/registration" +require "registration/storage" require "registration/url_helpers" require "suse/connect" @@ -153,5 +155,31 @@ erb.result(binding) end + def self.collect_autoyast_config(known_reg_codes) + options = Storage::InstallationOptions.instance + configuration = { + "do_registration" => true, + "email" => options.email, + "reg_code" => options.reg_code, + "install_updates" => options.install_updates + } + + reg_server = UrlHelpers.registration_url + configuration["reg_server"] = reg_server if reg_server + + if options.imported_cert_sha256_fingerprint + configuration["reg_server_cert_fingerprint_type"] = "SHA256" + configuration["reg_server_cert_fingerprint"] = options.imported_cert_sha256_fingerprint + end + + configuration["addons"] = Addon.registered.map do |addon| + addon_hash = addon.to_h(release_type_string: true) + addon_hash["reg_code"] = known_reg_codes[addon.identifier] || "" + addon_hash + end + + configuration + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/lib/registration/smt_status.rb new/yast2-registration-3.1.108/src/lib/registration/smt_status.rb --- old/yast2-registration-3.1.105/src/lib/registration/smt_status.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-3.1.108/src/lib/registration/smt_status.rb 2014-08-22 11:29:47.000000000 +0200 @@ -0,0 +1,50 @@ + +require "uri" +require "yast" + +require "registration/downloader" + +module Registration + + # Check SMT server status, check supported API + class SmtStatus + include Yast::Logger + + attr_reader :url, :insecure + + def initialize(url, insecure: false) + @url = url.is_a?(URI) ? url : URI(url) + @insecure = insecure + end + + # check whether (old) NCC API is present at the server + def ncc_api_present? + download_url = ncc_api_url + log.info "Checking NCC API presence: #{download_url}" + + begin + Downloader.download(download_url, insecure: insecure) + log.info "NCC API found" + return true + rescue DownloadError + log.info "Download failed, NCC API probably not present" + return false + end + end + + private + + # created NCC API URL for testing API presence + def ncc_api_url + # create an URI copy, the URL will be modified + ncc_url = url.dup + + # NCC API should provide "/center/regsvc?command=listproducts" query + ncc_url.path = "/center/regsvc" + ncc_url.query = "command=listproducts" + + ncc_url + end + end + +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/lib/registration/storage.rb new/yast2-registration-3.1.108/src/lib/registration/storage.rb --- old/yast2-registration-3.1.105/src/lib/registration/storage.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/lib/registration/storage.rb 2014-08-22 11:29:47.000000000 +0200 @@ -35,11 +35,12 @@ end # remember the values entered by user + # TODO use Config instead to allow easy export at installation class InstallationOptions include Singleton attr_accessor :install_updates, :email, :reg_code, :selected_addons, - :base_registered, :custom_url + :base_registered, :custom_url, :imported_cert_sha256_fingerprint def initialize @email = "" @@ -55,7 +56,6 @@ include Singleton def initialize - # TODO: handle registered addons in installed system self.registered_addons = [] self.first_run = true end @@ -158,7 +158,7 @@ def export_ssl_config ret = { "reg_server_cert" => reg_server_cert } - if reg_server_cert_fingerprint_type + if reg_server_cert_fingerprint_type && !reg_server_cert_fingerprint_type.empty? ret["reg_server_cert_fingerprint_type"] = reg_server_cert_fingerprint_type ret["reg_server_cert_fingerprint"] = reg_server_cert_fingerprint end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/lib/registration/ui/autoyast_config_workflow.rb new/yast2-registration-3.1.108/src/lib/registration/ui/autoyast_config_workflow.rb --- old/yast2-registration-3.1.105/src/lib/registration/ui/autoyast_config_workflow.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/lib/registration/ui/autoyast_config_workflow.rb 2014-08-22 11:29:47.000000000 +0200 @@ -143,13 +143,8 @@ ::Registration::Addon.selected.each do |addon| # TODO FIXME: use a separate class for handling Autoyast addons, # define == operator, etc... - new_addon = { - "name" => addon.identifier, - "version" => addon.version, - "arch" => addon.arch, - "release_type" => addon.release_type, - "reg_code" => known_reg_codes[addon.identifier] || "" - } + new_addon = addon.to_h + new_addon["reg_code"] = known_reg_codes[addon.identifier] || "" # already known? config_addon = find_addon(new_addon) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/lib/registration/ui/import_certificate_dialog.rb new/yast2-registration-3.1.108/src/lib/registration/ui/import_certificate_dialog.rb --- old/yast2-registration-3.1.105/src/lib/registration/ui/import_certificate_dialog.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/lib/registration/ui/import_certificate_dialog.rb 2014-08-22 11:29:47.000000000 +0200 @@ -64,6 +64,22 @@ private + def certificate_box + VBox( + HSpacing(75), + MarginBox(0.4, 0.4, RichText(certificate_description)), + ButtonBox( + # push button + PushButton(Id(:import), Opt(:key_F10, :okButton), _("&Trust and Import")), + PushButton( + Id(:cancel), + Opt(:key_F9, :cancelButton), + Yast::Label.CancelButton + ) + ) + ) + end + # create dialog content def import_dialog_content displayinfo = Yast::UI.GetDisplayInfo @@ -80,22 +96,7 @@ Empty() : HWeight(2, VBox(RichText(Opt(:disabled), warning_text))), HSpacing(1), - HWeight( - 5, - VBox( - HSpacing(75), - MarginBox(0.4, 0.4, RichText(certificate_description)), - ButtonBox( - # push button - PushButton(Id(:import), Opt(:key_F10, :okButton), _("&Trust and Import")), - PushButton( - Id(:cancel), - Opt(:key_F9, :cancelButton), - Yast::Label.CancelButton - ) - ) - ) - ) + HWeight(5, certificate_box) ) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/src/lib/registration/ui/local_server_dialog.rb new/yast2-registration-3.1.108/src/lib/registration/ui/local_server_dialog.rb --- old/yast2-registration-3.1.105/src/lib/registration/ui/local_server_dialog.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/src/lib/registration/ui/local_server_dialog.rb 2014-08-22 11:29:47.000000000 +0200 @@ -40,20 +40,7 @@ Yast::UI.OpenDialog(Opt(:decorated), dialog_content) begin - ui = nil - while ![:ok, :cancel].include?(ui) - Yast::UI.SetFocus(:url) - ui = Yast::UI.UserInput - log.info "User input: #{ui}" - - if ui == :ok && !valid_url? - # error message, the entered URL is not valid - Yast::Report.Error(_("Invalid URL.")) - ui = nil - end - end - - (ui == :ok) ? Yast::UI.QueryWidget(Id(:url), :Value) : nil + handle_dialog ensure Yast::UI.CloseDialog end @@ -61,6 +48,23 @@ private + def handle_dialog + ui = nil + while ![:ok, :cancel].include?(ui) + Yast::UI.SetFocus(:url) + ui = Yast::UI.UserInput + log.info "User input: #{ui}" + + if ui == :ok && !valid_url? + # error message, the entered URL is not valid + Yast::Report.Error(_("Invalid URL.")) + ui = nil + end + end + + (ui == :ok) ? Yast::UI.QueryWidget(Id(:url), :Value) : nil + end + def valid_url? begin uri = URI(Yast::UI.QueryWidget(Id(:url), :Value)) @@ -70,6 +74,21 @@ end end + def button_box + [ + PushButton( + Id(:ok), + Opt(:key_F10, :okButton, :default), + Yast::Label.OKButton + ), + PushButton( + Id(:cancel), + Opt(:key_F9, :cancelButton), + Yast::Label.CancelButton + ) + ] + end + # create dialog content def local_server_dialog_content MarginBox(1, 0.6, @@ -77,18 +96,7 @@ # input field label InputField(Id(:url), _("&Local Registration Server URL"), local_url), VSpacing(0.6), - ButtonBox( - PushButton( - Id(:ok), - Opt(:key_F10, :okButton, :default), - Yast::Label.OKButton - ), - PushButton( - Id(:cancel), - Opt(:key_F9, :cancelButton), - Yast::Label.CancelButton - ) - ) + ButtonBox(*button_box) ) ) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/test/addon_spec.rb new/yast2-registration-3.1.108/test/addon_spec.rb --- old/yast2-registration-3.1.105/test/addon_spec.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/test/addon_spec.rb 2014-08-22 11:29:47.000000000 +0200 @@ -243,4 +243,13 @@ end end + describe "#to_h" do + it "returns a Hash representation" do + product = addon_generator + + addon = Registration::Addon.new(product) + expect(addon.to_h).to be_a(Hash) + end + end + end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/test/downloader_spec.rb new/yast2-registration-3.1.108/test/downloader_spec.rb --- old/yast2-registration-3.1.105/test/downloader_spec.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/test/downloader_spec.rb 2014-08-22 11:29:47.000000000 +0200 @@ -45,7 +45,7 @@ expect_any_instance_of(Net::HTTP).to receive(:request). with(an_instance_of(Net::HTTP::Get)).and_return(index) - expect{Registration::Downloader.download(url)}.to raise_error RuntimeError, + expect{Registration::Downloader.download(url)}.to raise_error Registration::DownloadError, "Downloading #{url} failed: Not Found" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/test/helpers_spec.rb new/yast2-registration-3.1.108/test/helpers_spec.rb --- old/yast2-registration-3.1.105/test/helpers_spec.rb 2014-08-18 16:09:45.000000000 +0200 +++ new/yast2-registration-3.1.108/test/helpers_spec.rb 2014-08-22 11:29:47.000000000 +0200 @@ -202,4 +202,36 @@ end end + describe ".collect_autoyast_config" do + it "returns installation data as Autoyast hash" do + options = Registration::Storage::InstallationOptions.instance + options.email = "foo" + options.reg_code = "bar" + options.install_updates = true + options.imported_cert_sha256_fingerprint = "AB:CD:EF" + + expect(Registration::UrlHelpers).to receive (:registration_url) + + addon = Registration::Addon.new(addon_generator( + "zypper_name" => "sle-sdk", + "version" => "12", + "arch" => "x86_64", + "release_type" => nil + ) + ) + expect(Registration::Addon).to receive(:registered).and_return([addon]) + + expect(Registration::Helpers.collect_autoyast_config({})).to eq( + "do_registration" => true, + "email" => "foo", + "reg_code" => "bar", + "install_updates" => true, + "addons" => [{"name"=>"sle-sdk", "arch"=>"x86_64", "version"=>"12", + "release_type"=>"nil", "reg_code"=>""}], + "reg_server_cert_fingerprint" => "AB:CD:EF", + "reg_server_cert_fingerprint_type" => "SHA256" + ) + end + end + end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.105/test/smt_status_spec.rb new/yast2-registration-3.1.108/test/smt_status_spec.rb --- old/yast2-registration-3.1.105/test/smt_status_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-3.1.108/test/smt_status_spec.rb 2014-08-22 11:29:47.000000000 +0200 @@ -0,0 +1,35 @@ +#! /usr/bin/env rspec + +require_relative "spec_helper" +require_relative "yast_stubs" + +describe "Registration::SmtStatus" do + before do + stub_yast_require + require "registration/smt_status" + end + + let(:url) { "https://example.com" } + subject { Registration::SmtStatus.new(url) } + + describe "#ncc_api_present?" do + let(:expected_url) { URI("#{url}/center/regsvc?command=listproducts") } + + it "returns true when /center/regsvc?command=listproducts returns OK" do + expect(Registration::Downloader).to receive(:download). + with(expected_url, :insecure => false). + and_return(true) + + expect(subject.ncc_api_present?).to be_true + end + + it "returns false otherwise" do + expect(Registration::Downloader).to receive(:download). + with(expected_url, :insecure => false). + and_raise(Registration::DownloadError) + + expect(subject.ncc_api_present?).to be_false + end + end + +end continue with "q"... Checked in at Fri Aug 22 15:44:12 CEST 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