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# 873198 : "yast2-registraion: update existing services" (RESOLVED/FIXED) ## BNC# 873193 : "yast2-registration send wrong product version" (NEEDINFO/) ## BNC# 873882 : "Launch 2nd SCC Configuration in Yast2 causes "undefined method '[]' for nil:NilClass" error" (RESOLVED/FIXED) Changes: -------- --- /work/SRC/SUSE:SLE-12:GA/yast2-registration/yast2-registration.changes 2014-04-17 14:20:31.000000000 +0200 +++ /mounts/work_src_done/SLE12/yast2-registration/yast2-registration.changes 2014-04-22 09:27:37.000000000 +0200 @@ -1,0 +2,26 @@ +Tue Apr 22 07:04:33 UTC 2014 - lslezak@suse.cz + +- use "registration code" term everywhere to be consistent with + SCC terminology + +------------------------------------------------------------------- +Fri Apr 18 10:00:40 UTC 2014 - lslezak@suse.cz + +- do not fail if the service already exists (bnc#873198) +- 3.1.37 + +------------------------------------------------------------------- +Thu Apr 18 08:42:01 UTC 2014 - lslezak@suse.cz + +- send base product base version (i.e. remove build suffix from the + version) (bnc#873193) +- 3.1.36 + +------------------------------------------------------------------- +Thu Apr 17 09:45:50 UTC 2014 - lslezak@suse.cz + +- check the libzypp lock at start, do not continue if libzypp is + already locked by another application (bnc#873882) +- check the base product at start to avoid problems later + +------------------------------------------------------------------- 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:36596 MAIL:yast-commit@opensuse.org) (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-registration", Maintainer is "yast-commit@opensuse.org" Old: ---- yast2-registration-3.1.35.tar.bz2 New: ---- yast2-registration-3.1.37.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-registration.spec ++++++ --- /var/tmp/diff_new_pack.pcU3vF/_old 2014-04-22 12:35:24.000000000 +0200 +++ /var/tmp/diff_new_pack.pcU3vF/_new 2014-04-22 12:35:24.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.1.35 +Version: 3.1.37 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-registration-3.1.35.tar.bz2 -> yast2-registration-3.1.37.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/Gemfile new/yast2-registration-3.1.37/Gemfile --- old/yast2-registration-3.1.35/Gemfile 2014-04-17 10:28:26.000000000 +0200 +++ new/yast2-registration-3.1.37/Gemfile 2014-04-22 09:28:26.000000000 +0200 @@ -1,5 +1,7 @@ source "https://rubygems.org" +gem "scc_api", :github => "yast/rubygem-scc_api" + group :test do gem "rake" gem "rspec" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/package/yast2-registration.changes new/yast2-registration-3.1.37/package/yast2-registration.changes --- old/yast2-registration-3.1.35/package/yast2-registration.changes 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/package/yast2-registration.changes 2014-04-22 09:28:26.000000000 +0200 @@ -1,4 +1,30 @@ ------------------------------------------------------------------- +Tue Apr 22 07:04:33 UTC 2014 - lslezak@suse.cz + +- use "registration code" term everywhere to be consistent with + SCC terminology + +------------------------------------------------------------------- +Fri Apr 18 10:00:40 UTC 2014 - lslezak@suse.cz + +- do not fail if the service already exists (bnc#873198) +- 3.1.37 + +------------------------------------------------------------------- +Thu Apr 18 08:42:01 UTC 2014 - lslezak@suse.cz + +- send base product base version (i.e. remove build suffix from the + version) (bnc#873193) +- 3.1.36 + +------------------------------------------------------------------- +Thu Apr 17 09:45:50 UTC 2014 - lslezak@suse.cz + +- check the libzypp lock at start, do not continue if libzypp is + already locked by another application (bnc#873882) +- check the base product at start to avoid problems later + +------------------------------------------------------------------- Tue Apr 15 16:47:27 UTC 2014 - lslezak@suse.cz - fixed using nil base product when registration failed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/package/yast2-registration.spec new/yast2-registration-3.1.37/package/yast2-registration.spec --- old/yast2-registration-3.1.35/package/yast2-registration.spec 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/package/yast2-registration.spec 2014-04-22 09:28:26.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.1.35 +Version: 3.1.37 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/src/autoyast-rnc/registration.rnc new/yast2-registration-3.1.37/src/autoyast-rnc/registration.rnc --- old/yast2-registration-3.1.35/src/autoyast-rnc/registration.rnc 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/src/autoyast-rnc/registration.rnc 2014-04-22 09:28:26.000000000 +0200 @@ -7,21 +7,21 @@ do_registration? & email? & install_updates? & - reg_key? & + reg_code? & reg_server? & reg_server_cert? & slp_discovery? } addons = element addons { LIST, addon } -addon = element addon { addon_name & addon_reg_key? } +addon = element addon { addon_name & addon_reg_code? } addon_name = element name { text } -addon_reg_key = element reg_key { text } +addon_reg_code = element reg_code { text } do_registration = element do_registration { BOOLEAN } reg_server = element reg_server { text } reg_server_cert = element reg_server_cert { text } email = element email { text } -reg_key = element reg_key { text } +reg_code = element reg_code { text } install_updates = element install_updates { BOOLEAN } slp_discovery = element slp_discovery { BOOLEAN } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/src/clients/inst_scc.rb new/yast2-registration-3.1.37/src/clients/inst_scc.rb --- old/yast2-registration-3.1.35/src/clients/inst_scc.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/src/clients/inst_scc.rb 2014-04-22 09:28:26.000000000 +0200 @@ -62,35 +62,35 @@ @selected_addons = ::Registration::Storage::InstallationOptions.instance.selected_addons - initialize_regkeys + initialize_regcodes start_workflow end private - # initialize known reg. keys - def initialize_regkeys - @known_reg_keys = ::Registration::Storage::RegKeys.instance.reg_keys - if @known_reg_keys - log.info "Known reg keys: #{@known_reg_keys.size} keys" + # initialize known reg. codes + def initialize_regcodes + @known_reg_codes = ::Registration::Storage::RegCodes.instance.reg_codes + if @known_reg_codes + log.info "Known reg codes: #{@known_reg_codes.size} codes" return end if !Mode.normal - # read registration keys from USB media - log.info "Reading keys from USB media..." + # read registration codes from USB media + log.info "Reading codes from USB media..." # TODO FIXME: placeholder for FATE#316796 (https://fate.suse.com/316796) - # read the keys here, return Hash with mapping product_name => reg_key - @known_reg_keys = {} - log.info "Found #{@known_reg_keys.size} keys" + # read the codes here, return Hash with mapping product_name => reg_code + @known_reg_codes = {} + log.info "Found #{@known_reg_codes.size} codes" else - log.info "Initializing empty known reg keys" - @known_reg_keys = {} + log.info "Initializing empty known reg codes" + @known_reg_codes = {} end # cache the values - ::Registration::Storage::RegKeys.instance.reg_keys = @known_reg_keys + ::Registration::Storage::RegCodes.instance.reg_codes = @known_reg_codes end def register_base_system @@ -453,8 +453,8 @@ end - # create widgets for entering the addon reg keys - def addon_regkey_items(addons) + # create widgets for entering the addon reg codes + def addon_regcode_items(addons) textmode = UI.TextMode box = VBox() @@ -463,7 +463,7 @@ label << " (#{addon.long_name})" unless addon.long_name.empty? box[box.size] = MinWidth(REG_CODE_WIDTH, InputField(Id(addon.product_ident), label, - @known_reg_keys.fetch(addon.product_ident, ""))) + @known_reg_codes.fetch(addon.product_ident, ""))) # add extra spacing when there are just few addons, in GUI always box[box.size] = VSpacing(1) if (addons.size < 5) || !textmode end @@ -471,8 +471,8 @@ box end - # create content for the addon reg keys dialog - def addon_regkeys_dialog_content(addons) + # create content for the addon reg codes dialog + def addon_regcodes_dialog_content(addons) # display the second column if needed if addons.size > MAX_REGCODES_PER_COLUMN # display only the addons which fit two column layout @@ -481,13 +481,13 @@ # round the half up (more items in the first column for odd number of items) half = (display_addons.size + 1) / 2 - box1 = addon_regkey_items(display_addons[0..half - 1]) + box1 = addon_regcode_items(display_addons[0..half - 1]) box2 = HBox( HSpacing(2), - addon_regkey_items(display_addons[half..-1]) + addon_regcode_items(display_addons[half..-1]) ) else - box1 = addon_regkey_items(addons) + box1 = addon_regcode_items(addons) end HBox( @@ -518,8 +518,8 @@ @available_addons end - # handle user input in the addon reg keys dialog - def handle_register_addons_dialog(addons_with_keys) + # handle user input in the addon reg codes dialog + def handle_register_addons_dialog(addons_with_codes) continue_buttons = [:next, :back, :close, :abort] ret = nil @@ -527,7 +527,7 @@ ret = UI.UserInput if ret == :next - collect_addon_regkeys(addons_with_keys) + collect_addon_regcodes(addons_with_codes) # register the add-ons ret = nil unless register_selected_addons @@ -537,13 +537,13 @@ return ret end - # collect the entered reg keys from UI + # collect the entered reg codes from UI # @return [Hash<Addon,String>] addon => reg. code mapping - def collect_addon_regkeys(addons_with_keys) - pairs = addons_with_keys.map do |a| + def collect_addon_regcodes(addons_with_codes) + pairs = addons_with_codes.map do |a| [a.product_ident, UI.QueryWidget(Id(a.product_ident), :Value)] end - @known_reg_keys.merge!(Hash[pairs]) + @known_reg_codes.merge!(Hash[pairs]) end # register all selected addons @@ -568,7 +568,7 @@ products = registration_order.map do |a| { "name" => a.product_ident, - "reg_key" => @known_reg_keys[a.product_ident], + "reg_code" => @known_reg_codes[a.product_ident], "arch" => a.arch, "version" => a.version } @@ -591,17 +591,17 @@ return ret end - # run the addon reg keys dialog + # run the addon reg codes dialog def register_addons - missing_regkeys = @selected_addons.reject(&:free) + missing_regcodes = @selected_addons.reject(&:free) - # if registering only add-ons which do not need a reg. key (like SDK) + # if registering only add-ons which do not need a reg. code (like SDK) # then simply start the registration - if missing_regkeys.empty? + if missing_regcodes.empty? Wizard.SetContents( # dialog title _("Registering Selected Add-on Products and Extensions"), - # display only the products which need a registration key + # display only the products which need a registration code Empty(), # FIXME: help text "", @@ -613,16 +613,16 @@ else Wizard.SetContents( # dialog title - _("Enter Registration Keys for Selected Add-on Products and Extensions"), - # display only the products which need a registration key - addon_regkeys_dialog_content(missing_regkeys), + _("Enter Registration Codes for Selected Add-on Products and Extensions"), + # display only the products which need a registration code + addon_regcodes_dialog_content(missing_regcodes), # FIXME: help text "", GetInstArgs.enable_back || Mode.normal, GetInstArgs.enable_next || Mode.normal ) - return handle_register_addons_dialog(missing_regkeys) + return handle_register_addons_dialog(missing_regcodes) end end @@ -681,6 +681,13 @@ end def registration_check + # check the base product at start to avoid problems later + if ::Registration::SwMgmt.find_base_product.nil? + # error message + Report.Error(_("The base product was not found,\ncheck your system.")) + return Mode.normal ? :abort : :auto + end + if Mode.normal && ::Registration::Registration.is_registered? return display_registered_dialog else @@ -702,6 +709,7 @@ sequence = { "ws_start" => "check", "check" => { + :auto => :auto, :abort => :abort, :cancel => :abort, :register => "register", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/src/clients/scc.rb new/yast2-registration-3.1.37/src/clients/scc.rb --- old/yast2-registration-3.1.35/src/clients/scc.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/src/clients/scc.rb 2014-04-22 09:28:26.000000000 +0200 @@ -45,7 +45,7 @@ CommandLine.Run(cmdline_description) else Wizard.CreateDialog - ::Registration::SwMgmt.init + return :abort unless ::Registration::SwMgmt.init begin return WFM.call("inst_scc") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/src/clients/scc_auto.rb new/yast2-registration-3.1.37/src/clients/scc_auto.rb --- old/yast2-registration-3.1.35/src/clients/scc_auto.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/src/clients/scc_auto.rb 2014-04-22 09:28:26.000000000 +0200 @@ -164,7 +164,7 @@ Popup.Feedback(_("Registering the System..."), _("Contacting the SUSE Customer Center server")) do - @registration.register(@config.email, @config.reg_key) + @registration.register(@config.email, @config.reg_code) end # register the base product @@ -181,7 +181,7 @@ addon_products = @config.addons.map do |a| { "name" => a["name"], - "reg_key" => a["reg_key"], + "reg_code" => a["reg_code"], # TODO FIXME: not handled by SCC yet "arch" => nil, "version" => nil @@ -226,17 +226,17 @@ def set_addon_table_content(current = nil) content = @config.addons.map do |a| - Item(Id(a["name"]), a["name"], a["reg_key"]) + Item(Id(a["name"]), a["name"], a["reg_code"]) end UI.ChangeWidget(Id(:addons_table), :Items, content) UI.ChangeWidget(Id(:addons_table), :CurrentItem, current) if current end - def display_addon_popup(name = "", reg_key = "") + def display_addon_popup(name = "", reg_code = "") content = VBox( InputField(Id(:name), _("Add-on &Name"), name), - InputField(Id(:reg_key), _("Registration &Key"), reg_key), + InputField(Id(:reg_code), _("Registration &Code"), reg_code), VSpacing(1), HBox( PushButton(Id(:ok), Label.OKButton), @@ -252,7 +252,7 @@ if ui == :ok return { "name" => UI.QueryWidget(Id(:name), :Value), - "reg_key" => UI.QueryWidget(Id(:reg_key), :Value) + "reg_code" => UI.QueryWidget(Id(:reg_code), :Value) } else return nil @@ -275,10 +275,10 @@ if selected addon = @config.addons.find{|a| a["name"] == selected} - ret = display_addon_popup(selected, addon["reg_key"]) + ret = display_addon_popup(selected, addon["reg_code"]) if ret addon["name"] = ret["name"] - addon["reg_key"] = ret["reg_key"] + addon["reg_code"] = ret["reg_code"] set_addon_table_content(addon["name"]) end end @@ -289,7 +289,7 @@ if ret addon = @config.addons.find{|a| a["name"] == ret["name"]} if addon - addon["reg_key"] = ret["reg_key"] + addon["reg_code"] = ret["reg_code"] else @config.addons << ret end @@ -298,7 +298,7 @@ end def select_addons - header = Header(_("Name"), _("Registration key")) + header = Header(_("Name"), _("Registration Code")) contents = VBox( Table(Id(:addons_table), header, []), HBox( @@ -334,7 +334,7 @@ def refresh_widget_state enabled = UI.QueryWidget(Id(:do_registration), :Value) - all_widgets = [ :reg_server_cert, :email, :reg_key, :slp_discovery, + all_widgets = [ :reg_server_cert, :email, :reg_code, :slp_discovery, :install_updates, :addons ] all_widgets.each do |w| @@ -366,14 +366,14 @@ ) ) - reg_key_settings = VBox( + reg_code_settings = VBox( # Translators: Text for UI Label - capitalized Frame(_("Registration"), VBox( MinWidth(32, InputField(Id(:email), _("&Email"), @config.email)), VSpacing(0.4), - MinWidth(32, InputField(Id(:reg_key), _("Registration &Code"), - @config.reg_key)), + MinWidth(32, InputField(Id(:reg_code), _("Registration &Code"), + @config.reg_code)), VSpacing(0.4), Left(CheckBox(Id(:install_updates), _("Install Available Patches from Update Repositories"), @@ -414,7 +414,7 @@ HSpacing(2), VBox( VSpacing(1), - reg_key_settings, + reg_code_settings, VSpacing(1), server_settings, VSpacing(0.4), @@ -446,7 +446,7 @@ if ret == :next || ret == :addons data_widgets = [ :do_registration, :reg_server, :reg_server_cert, - :email, :reg_key, :slp_discovery, :install_updates + :email, :reg_code, :slp_discovery, :install_updates ] data = data_widgets.map do |w| diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/src/data/registration/summary.erb new/yast2-registration-3.1.37/src/data/registration/summary.erb --- old/yast2-registration-3.1.35/src/data/registration/summary.erb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/src/data/registration/summary.erb 2014-04-22 09:28:26.000000000 +0200 @@ -17,8 +17,8 @@ <h3><%= _("Registration Settings") %></h3> <ul> <li><%= _("Email: %s") % h(@config.email) %></li> - <% if !@config.reg_key.empty? %> - <li><%= _("Registration Key is Configured") %></li> + <% if !@config.reg_code.empty? %> + <li><%= _("Registration Code is Configured") %></li> <% end %> <% if @config.install_updates %> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/src/lib/registration/addon.rb new/yast2-registration-3.1.37/src/lib/registration/addon.rb --- old/yast2-registration-3.1.35/src/lib/registration/addon.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/src/lib/registration/addon.rb 2014-04-22 09:28:26.000000000 +0200 @@ -26,18 +26,18 @@ # product data needed for registration attr_reader :name, :version, :arch # additional data: UI labels, dependencies on other add-ons and - # a flag indicating required registration key - attr_reader :label, :description, :depends_on, :regkey_needed + # a flag indicating required registration code + attr_reader :label, :description, :depends_on, :regcode_needed def initialize(name, version, arch, label: "", description: "", - depends_on: [], regkey_needed: true) + depends_on: [], regcode_needed: true) @name = name @version = version @arch = arch @label = label @description = description @depends_on = depends_on - @regkey_needed = regkey_needed + @regcode_needed = regcode_needed end # recursively collect all addon dependecies and create a flat list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/src/lib/registration/helpers.rb new/yast2-registration-3.1.37/src/lib/registration/helpers.rb --- old/yast2-registration-3.1.35/src/lib/registration/helpers.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/src/lib/registration/helpers.rb 2014-04-22 09:28:26.000000000 +0200 @@ -113,6 +113,14 @@ Yast::WFM.call("inst_lan", [{"skip_detection" => true}]) end + # return base version + # "12-1.47" => "12" + # "12-1" => "12" + # "12.1-1.47" => "12.1" + # "12.1-1" => "12.1" + def self.base_version(version) + version.sub(/-.*\z/, "") + end private diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/src/lib/registration/registration.rb new/yast2-registration-3.1.37/src/lib/registration/registration.rb --- old/yast2-registration-3.1.35/src/lib/registration/registration.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/src/lib/registration/registration.rb 2014-04-22 09:28:26.000000000 +0200 @@ -66,12 +66,12 @@ begin orig_reg_code = @scc.reg_code - # use product specific reg. key (e.g. for addons) - @scc.reg_code = product["reg_key"] if product["reg_key"] + # use product specific reg. code (e.g. for addons) + @scc.reg_code = product["reg_code"] if product["reg_code"] ret = @scc.register(product) ensure - # restore the original base product key + # restore the original base product code @scc.reg_code = orig_reg_code end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/src/lib/registration/storage.rb new/yast2-registration-3.1.37/src/lib/registration/storage.rb --- old/yast2-registration-3.1.35/src/lib/registration/storage.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/src/lib/registration/storage.rb 2014-04-22 09:28:26.000000000 +0200 @@ -30,7 +30,7 @@ module Storage # storage for changed repositories - class RegKeys < Struct.new(:reg_keys) + class RegCodes < Struct.new(:reg_codes) include Singleton end @@ -62,7 +62,7 @@ include Singleton attr_accessor :do_registration, :reg_server, :reg_server_cert, :email, - :reg_key, :install_updates, :addons, :slp_discovery + :reg_code, :install_updates, :addons, :slp_discovery def initialize reset @@ -73,7 +73,7 @@ @reg_server = "" @reg_server_cert = "" @email = "" - @reg_key = "" + @reg_code = "" @install_updates = false @addons = [] @slp_discovery = false @@ -89,7 +89,7 @@ "slp_discovery" => @slp_discovery, "reg_server_cert" => @reg_server_cert, "email" => @email, - "reg_key" => @reg_key, + "reg_code" => @reg_code, "install_updates" => @install_updates, "addons" => @addons } @@ -105,7 +105,7 @@ @slp_discovery = settings.fetch("slp_discovery", false) @reg_server_cert = settings["reg_server_cert"] || "" @email = settings["email"] || "" - @reg_key = settings["reg_key"] || "" + @reg_code = settings["reg_code"] || "" @install_updates = settings.fetch("install_updates", false) @addons = settings["addons"] || [] end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/src/lib/registration/sw_mgmt.rb new/yast2-registration-3.1.37/src/lib/registration/sw_mgmt.rb --- old/yast2-registration-3.1.35/src/lib/registration/sw_mgmt.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/src/lib/registration/sw_mgmt.rb 2014-04-22 09:28:27.000000000 +0200 @@ -27,10 +27,12 @@ require "fileutils" require "registration/exceptions" +require "registration/helpers" module Registration Yast.import "Mode" Yast.import "Pkg" + Yast.import "PackageLock" Yast.import "Installation" Yast.import "PackageCallbacksInit" @@ -44,10 +46,15 @@ ZYPP_DIR = "/etc/zypp" def self.init + # false = do not allow continuing without the libzypp lock + lock = PackageLock.Connect(false) + return false unless lock["connected"] + # display progress when refreshing repositories PackageCallbacksInit.InitPackageCallbacks Pkg.TargetInitialize(Installation.destdir) Pkg.TargetLoad + Pkg.SourceRestore end # during installation /etc/zypp directory is not writable (mounted on @@ -93,7 +100,9 @@ def self.base_product_to_register # just for debugging: - # return {"name" => "SLES", "arch" => "x86_64", "version" => "12-1.47"} + # return {"name" => "SLES", "arch" => "x86_64", "version" => "12", + # "release_type" => "DVD" + # } base_product = find_base_product @@ -101,7 +110,7 @@ product_info = { "name" => base_product["name"], "arch" => base_product["arch"], - "version" => base_product["version"], + "version" => ::Registration::Helpers.base_version(base_product["version"]), "release_type" => base_product["flavor"] } @@ -124,7 +133,7 @@ product_services.map(&:services).flatten.each do |service| log.info "Adding service #{service.name.inspect} (#{service.url})" - credentials_file = Helpers.credentials_from_url(service.url) + credentials_file = ::Registration::Helpers.credentials_from_url(service.url) if credentials_file # TODO FIXME: SCC currenly does not return credentials for the service, @@ -133,10 +142,28 @@ credentials.write end - if !Pkg.ServiceAdd(service.name, service.url.to_s) - # error message - raise ::Registration::ServiceError.new(N_("Adding service '%s' failed."), service.name) + # add a new service or update the existing service + if Pkg.ServiceAliases.include?(service.name) + log.info "Updating existing service: #{service.name}" + if !Pkg.ServiceSet(service.name, { + "alias" => service.name, + "name" => service.name, + "url" => service.url.to_s, + "enabled" => true, + "autorefresh" => true, + }) + + ## error message + raise ::Registration::ServiceError.new(N_("Updating service '%s' failed."), service.name) + end + else + log.info "Adding new service: #{service.name}" + if !Pkg.ServiceAdd(service.name, service.url.to_s) + # error message + raise ::Registration::ServiceError.new(N_("Adding service '%s' failed."), service.name) + end end + # refresh works only for saved services if !Pkg.ServiceSave(service.name) # error message diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/test/helpers_spec.rb new/yast2-registration-3.1.37/test/helpers_spec.rb --- old/yast2-registration-3.1.35/test/helpers_spec.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/test/helpers_spec.rb 2014-04-22 09:28:27.000000000 +0200 @@ -144,4 +144,17 @@ end end + describe ".base_version" do + it "returns the version if build suffix is missing" do + expect(Registration::Helpers.base_version("12")).to eq("12") + expect(Registration::Helpers.base_version("12.1")).to eq("12.1") + end + + it "returns base version without build suffix" do + expect(Registration::Helpers.base_version("12.1-1.47")).to eq("12.1") + expect(Registration::Helpers.base_version("12.1-1")).to eq("12.1") + expect(Registration::Helpers.base_version("12-1.47")).to eq("12") + expect(Registration::Helpers.base_version("12-1")).to eq("12") + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/test/inst_scc_test.rb new/yast2-registration-3.1.37/test/inst_scc_test.rb --- old/yast2-registration-3.1.35/test/inst_scc_test.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/test/inst_scc_test.rb 2014-04-22 09:28:27.000000000 +0200 @@ -15,6 +15,7 @@ allow(Yast::UI).to receive(:ChangeWidget) allow(Yast::UI).to receive(:SetFocus) allow(Yast::UI).to receive(:ReplaceWidget) + expect(Registration::SwMgmt).to receive(:find_base_product).and_return("name" => "SLES") end context "the system is already registered" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/test/scc_test.rb new/yast2-registration-3.1.37/test/scc_test.rb --- old/yast2-registration-3.1.35/test/scc_test.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/test/scc_test.rb 2014-04-22 09:28:27.000000000 +0200 @@ -20,7 +20,8 @@ expect(Yast::Wizard).to receive(:CreateDialog) expect(Yast::Wizard).to receive(:CloseDialog) - expect(Registration::SwMgmt).to receive(:init) + expect(Registration::SwMgmt).to receive(:init).and_return(true) + expect(Registration::SwMgmt).to receive(:find_base_product).and_return("name" => "SLES") end context "the system is already registered" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.35/test/sw_mgmt_spec.rb new/yast2-registration-3.1.37/test/sw_mgmt_spec.rb --- old/yast2-registration-3.1.35/test/sw_mgmt_spec.rb 2014-04-17 10:28:27.000000000 +0200 +++ new/yast2-registration-3.1.37/test/sw_mgmt_spec.rb 2014-04-22 09:28:27.000000000 +0200 @@ -3,6 +3,8 @@ require_relative "spec_helper" require_relative "yast_stubs" +require "scc_api" + describe "Registration::SwMgmt" do let(:yast_pkg) { double("Yast::Pkg") } @@ -14,9 +16,10 @@ end describe ".service_repos" do - it "returns list of repositories belonging to a service" do - service_name = "SLES" - repos = { + let(:services) { double } + let(:service_name) { "SLES" } + let(:repos) do + { # installation repository, not from registration 0 => { "alias"=>"SLES12", "autorefresh"=>false, @@ -54,19 +57,64 @@ "url"=>"https://nu.novell.com/suse/x86_64/update/SLE-SERVER/12" } } + end + before do service = double expect(service).to receive(:name).and_return(service_name) - services = double expect(services).to receive(:services).and_return([service]) expect(yast_pkg).to receive(:SourceGetCurrent).with(false).and_return(repos.keys) repos.each do |id, repo| expect(yast_pkg).to receive(:SourceGeneralData).with(id).and_return(repo) end + end + it "returns list of repositories belonging to a service" do expect(Registration::SwMgmt.service_repos([services])).to eq([repos[1], repos[2]]) end + + it "optionally returns only update repositories" do + expect(Registration::SwMgmt.service_repos([services], only_updates: true)).to eq([repos[2]]) + end + end + + describe ".base_product_to_register" do + it "returns base product base version and release_type" do + expect(Registration::SwMgmt).to(receive(:find_base_product) + .and_return({"name" => "SLES", "arch" => "x86_64", "version" => "12.1-1.47", "flavor" => "DVD"})) + + expect(Registration::SwMgmt.base_product_to_register).to eq({"name" => "SLES", + "arch" => "x86_64", "version" => "12.1", "release_type" => "DVD"}) + end + end + + describe ".add_services" do + let(:service_url) { "https://example.com/foo/bar?credentials=TEST_credentials" } + let(:credentials) { SccApi::Credentials.new("user", "password", "file") } + let(:product_services) do + service = SccApi::Service.new("test", service_url) + SccApi::ProductServices.new([service], [], []) + end + + before do + expect(yast_pkg).to receive(:SourceSaveAll).and_return(true).twice + expect(yast_pkg).to receive(:ServiceRefresh).with("test").and_return(true) + expect(yast_pkg).to receive(:ServiceSave).with("test").and_return(true) + expect(credentials).to receive(:write) + end + + it "it creates a new service if the service does not exist yet" do + expect(yast_pkg).to receive(:ServiceAliases).and_return([]) + expect(yast_pkg).to receive(:ServiceAdd).with("test", service_url).and_return(true) + expect { Registration::SwMgmt.add_services([product_services], credentials) }.to_not raise_error + end + + it "updates the existing service if the service already exists" do + expect(yast_pkg).to receive(:ServiceAliases).and_return(["test"]) + expect(yast_pkg).to receive(:ServiceSet).with("test", hash_including("url" => service_url)).and_return(true) + expect { Registration::SwMgmt.add_services([product_services], credentials) }.to_not raise_error + end end end continue with "q"... Checked in at Tue Apr 22 12:35:42 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