[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 Changes: -------- --- /work/SRC/SUSE:SLE-12:GA/yast2-registration/yast2-registration.changes 2014-02-26 16:44:39.000000000 +0100 +++ /mounts/work_src_done/SLE12/yast2-registration/yast2-registration.changes 2014-02-27 14:17:13.000000000 +0100 @@ -1,0 +2,6 @@ +Thu Feb 27 08:35:31 UTC 2014 - lslezak@suse.cz + +- Check for errors when adding/refreshing services +- 3.1.13 + +------------------------------------------------------------------- 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:33540 MAIL:yast-commit@opensuse.org) (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-registration", Maintainer is "yast-commit@opensuse.org" Old: ---- yast2-registration-3.1.12.tar.bz2 New: ---- yast2-registration-3.1.13.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-registration.spec ++++++ --- /var/tmp/diff_new_pack.0iZhH4/_old 2014-02-27 16:15:52.000000000 +0100 +++ /var/tmp/diff_new_pack.0iZhH4/_new 2014-02-27 16:15:52.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.1.12 +Version: 3.1.13 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -28,13 +28,11 @@ Requires: yast2 >= 2.23.13 Requires: yast2-pkg-bindings >= 2.17.20 -# Y2Logger -Requires: yast2-ruby-bindings >= 3.1.7 +# N_() method +Requires: yast2-ruby-bindings >= 3.1.12 # SCC API library Requires: rubygem-scc_api >= 0.2.4 Requires: yast2-slp >= 3.1.2 -# Language module -Requires: yast2-country BuildRequires: yast2 >= 2.23.13 BuildRequires: update-desktop-files ++++++ yast2-registration-3.1.12.tar.bz2 -> yast2-registration-3.1.13.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.12/package/yast2-registration.changes new/yast2-registration-3.1.13/package/yast2-registration.changes --- old/yast2-registration-3.1.12/package/yast2-registration.changes 2014-02-26 15:09:57.000000000 +0100 +++ new/yast2-registration-3.1.13/package/yast2-registration.changes 2014-02-27 14:14:53.000000000 +0100 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Feb 27 08:35:31 UTC 2014 - lslezak@suse.cz + +- Check for errors when adding/refreshing services +- 3.1.13 + +------------------------------------------------------------------- Wed Feb 26 14:44:09 CET 2014 - locilka@suse.com - Initializing packager before registration on a running system diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.12/package/yast2-registration.spec new/yast2-registration-3.1.13/package/yast2-registration.spec --- old/yast2-registration-3.1.12/package/yast2-registration.spec 2014-02-26 15:09:57.000000000 +0100 +++ new/yast2-registration-3.1.13/package/yast2-registration.spec 2014-02-27 14:14:53.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-registration -Version: 3.1.12 +Version: 3.1.13 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -28,13 +28,11 @@ Requires: yast2 >= 2.23.13 Requires: yast2-pkg-bindings >= 2.17.20 -# Y2Logger -Requires: yast2-ruby-bindings >= 3.1.7 +# N_() method +Requires: yast2-ruby-bindings >= 3.1.12 # SCC API library Requires: rubygem-scc_api >= 0.2.4 Requires: yast2-slp >= 3.1.2 -# Language module -Requires: yast2-country BuildRequires: yast2 >= 2.23.13 BuildRequires: update-desktop-files diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.12/src/Makefile.am new/yast2-registration-3.1.13/src/Makefile.am --- old/yast2-registration-3.1.12/src/Makefile.am 2014-02-26 15:09:57.000000000 +0100 +++ new/yast2-registration-3.1.13/src/Makefile.am 2014-02-27 14:14:53.000000000 +0100 @@ -9,7 +9,9 @@ ylibdir = @ylibdir@/registration ylib_DATA = \ - lib/registration/registration.rb + lib/registration/exceptions.rb \ + lib/registration/sw_mgmt.rb \ + lib/registration/helpers.rb EXTRA_DIST = $(client_DATA) $(desktop_DATA) $(ylib_DATA) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.12/src/clients/inst_scc.rb new/yast2-registration-3.1.13/src/clients/inst_scc.rb --- old/yast2-registration-3.1.12/src/clients/inst_scc.rb 2014-02-26 15:09:57.000000000 +0100 +++ new/yast2-registration-3.1.13/src/clients/inst_scc.rb 2014-02-27 14:14:53.000000000 +0100 @@ -25,18 +25,15 @@ # use external rubygem for SCC communication require "scc_api" -require "tmpdir" -require "fileutils" +require "registration/exceptions" +require "registration/helpers" module Yast class InstSccClient < Client include Yast::Logger - ZYPP_DIR = "/etc/zypp" - def main Yast.import "UI" - Yast.import "Pkg" textdomain "registration" @@ -45,9 +42,6 @@ Yast.import "Wizard" Yast.import "Report" Yast.import "Mode" - Yast.import "Progress" - Yast.import "PackageCallbacks" - Yast.import "Language" # redirect the scc_api log to y2log SccApi::GlobalLogger.instance.log = Y2Logger.instance @@ -90,6 +84,12 @@ else Report.Error(_("Registration failed.")) end + rescue Registration::ServiceError => e + log.error("Service error: #{e.message % e.service}") + Report.Error(_(e.message) % e.service) + rescue Registration::PkgError => e + log.error("Pkg error: #{e.message}") + Report.Error(_(e.message)) rescue Exception => e log.error("SCC registration failed: #{e}, #{e.backtrace}") Report.Error(_("Registration failed.")) @@ -109,7 +109,7 @@ scc = SccApi::Connection.new(email, reg_code) # set the current language to receive translated error messages - scc.language = language + scc.language = Registration::Helpers.language # announce (register the system) first credentials = run_with_feedback(_("Registering the System..."), _("Contacting the SUSE Customer Center server")) do @@ -117,7 +117,7 @@ end # ensure the zypp config directories are writable in inst-sys - ensure_zypp_config_writable + Registration::SwMgmt.zypp_config_writable! # write the global credentials credentials.write @@ -125,7 +125,7 @@ # then register the product(s) product_services = run_with_feedback(_("Registering the Product..."), _("Contacting the SUSE Customer Center server")) do # there will be just one base product, but theoretically there can be more... - selected_base_products.map do |base_product| + Registration::SwMgmt.products_to_register.map do |base_product| log.info("Registering base product: #{base_product.inspect}") scc.register(base_product) end @@ -144,38 +144,11 @@ ) Progress.NextStage - add_services(product_services, credentials) - Progress.Finish - end - end - # add the services to libzypp and load (refresh) them - def add_services(product_services, credentials) - # save repositories before refreshing added services (otherwise - # pkg-bindings will treat them as removed by the service refresh and - # unload them) - Pkg.SourceSaveAll - - # each registered product - product_services.each do |product_service| - # services for the each product - product_service.services.each do |service| - log.info "Adding service #{service.name.inspect} (#{service.url})" - - # progress bar label - Progress.Title(_("Adding service %s...") % service.name) - - # TODO FIXME: SCC currenly does not return credentials for the service, - # just reuse the global credentials and save to a different file - credentials.file = service.name + "_credentials" - credentials.write - - Pkg.ServiceAdd(service.name, service.url.to_s) - # refresh works only for saved services - Pkg.ServiceSave(service.name) - Pkg.ServiceRefresh(service.name) - - Progress.NextStep + begin + Registration::SwMgmt.add_services(product_services, credentials) + ensure + Progress.Finish end end end @@ -215,26 +188,6 @@ ) end - def selected_base_products - # just for debugging: - # return [{"name" => "SUSE_SLES", "arch" => "x86_64", "version" => "12-"}] - - # source 0 is the base installation repo, the repos added later are considered as add-ons - # although they can also contain a different base product - # - # on a running system, products are :installed - selected_base_products = Pkg.ResolvableProperties("", :product, "").find_all do |p| - p["status"] == :selected || p["status"] == :installed - end - - # filter out not needed data - product_info = selected_base_products.map{|p| { "name" => p["name"], "arch" => p["arch"], "version" => p["version"]}} - - log.info("Found selected/installed base products: #{product_info}") - - product_info - end - def run_with_feedback(header, label, &block) Popup.ShowFeedback(header, label) yield @@ -242,25 +195,6 @@ Popup.ClearFeedback end - # during installation /etc/zypp directory is not writable (mounted on - # a read-only file system), the workaround is to copy the whole directory - # structure into a writable temporary directory and override the original - # location by "mount -o bind" - def ensure_zypp_config_writable - if Mode.installation && !File.writable?(ZYPP_DIR) - log.info "Copying libzypp config to a writable place" - - # create writable zypp directory structure in /tmp - tmpdir = Dir.mktmpdir - - log.info "Copying #{ZYPP_DIR} to #{tmpdir} ..." - ::FileUtils.cp_r ZYPP_DIR, tmpdir - - log.info "Mounting #{tmpdir} to #{ZYPP_DIR}" - `mount -o bind #{tmpdir}/zypp #{ZYPP_DIR}` - end - end - def confirm_skipping # Popup question: confirm skipping the registration confirmation = _("If you do not register your system we will not be able\n" + @@ -272,19 +206,6 @@ Popup.YesNo(confirmation) end - def language - lang = Language.language - log.info "Current language: #{lang}" - - # remove the encoding (e.g. ".UTF-8") - lang.sub!(/\..*$/, "") - # replace lang/country separator "_" -> "-" - # see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4 - lang.tr!("_", "-") - - log.info "Language for HTTP requests set to #{lang.inspect}" - lang - end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.12/src/clients/scc.rb new/yast2-registration-3.1.13/src/clients/scc.rb --- old/yast2-registration-3.1.12/src/clients/scc.rb 2014-02-26 15:09:57.000000000 +0100 +++ new/yast2-registration-3.1.13/src/clients/scc.rb 2014-02-27 14:14:53.000000000 +0100 @@ -23,14 +23,15 @@ # this is just a wrapper for running the SCC client in installed system -require "registration/registration" +require "registration/sw_mgmt" module Yast import "Wizard" Wizard.CreateDialog - Yast::Registration.initialize_libzypp + Registration::SwMgmt.init + WFM.call("inst_scc") - Yast::Registration.save_libzypp + Wizard.CloseDialog end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.12/src/lib/registration/exceptions.rb new/yast2-registration-3.1.13/src/lib/registration/exceptions.rb --- old/yast2-registration-3.1.12/src/lib/registration/exceptions.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-3.1.13/src/lib/registration/exceptions.rb 2014-02-27 14:14:53.000000000 +0100 @@ -0,0 +1,36 @@ +# encoding: utf-8 + +# ------------------------------------------------------------------------------ +# Copyright (c) 2014 Novell, Inc. All Rights Reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, you may find +# current contact information at www.novell.com. +# ------------------------------------------------------------------------------ +# +# +module Registration + # Exception class for handling all Pkg errors + class PkgError < RuntimeError + end + + class ServiceError < PkgError + attr_reader :service + + def initialize(msg, service) + super(msg) + @service = service + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.12/src/lib/registration/helpers.rb new/yast2-registration-3.1.13/src/lib/registration/helpers.rb --- old/yast2-registration-3.1.12/src/lib/registration/helpers.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-3.1.13/src/lib/registration/helpers.rb 2014-02-27 14:14:53.000000000 +0100 @@ -0,0 +1,52 @@ +# encoding: utf-8 + +# ------------------------------------------------------------------------------ +# Copyright (c) 2014 Novell, Inc. All Rights Reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, you may find +# current contact information at www.novell.com. +# ------------------------------------------------------------------------------ +# +# + +require "yast" + +module Registration + + class Helpers + include Yast::Logger + + # Get the language for using in HTTP requests (in "Accept-Language" header) + def self.language + lang = Yast::WFM.GetLanguage + log.info "Current language: #{lang}" + + if lang == "POSIX" || lang == "C" + log.warn "Ignoring #{lang.inspect} language for HTTP requests" + return nil + end + + # remove the encoding (e.g. ".UTF-8") + lang.sub!(/\..*$/, "") + # replace lang/country separator "_" -> "-" + # see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4 + lang.tr!("_", "-") + + log.info "Language for HTTP requests set to #{lang.inspect}" + lang + end + + end +end \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.12/src/lib/registration/registration.rb new/yast2-registration-3.1.13/src/lib/registration/registration.rb --- old/yast2-registration-3.1.12/src/lib/registration/registration.rb 2014-02-26 15:09:57.000000000 +0100 +++ new/yast2-registration-3.1.13/src/lib/registration/registration.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,44 +0,0 @@ -# encoding: utf-8 - -# ------------------------------------------------------------------------------ -# Copyright (c) 2014 Novell, Inc. All Rights Reserved. -# -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of version 2 of the GNU General Public License as published by the -# Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, contact Novell, Inc. -# -# To contact Novell about this file by physical or electronic mail, you may find -# current contact information at www.novell.com. -# ------------------------------------------------------------------------------ -# -# - -require "yast" - -module Yast - Yast.import "Pkg" - Yast.import "Installation" - Yast.import "PackageCallbacksInit" - - class Registration - def self.initialize_libzypp - PackageCallbacksInit.InitPackageCallbacks - Pkg.TargetInitialize(Installation.destdir) - Pkg.TargetLoad - Pkg.SourceStartManager(true) - end - - def self.save_libzypp - Pkg.SourceSaveAll - end - end -end - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-registration-3.1.12/src/lib/registration/sw_mgmt.rb new/yast2-registration-3.1.13/src/lib/registration/sw_mgmt.rb --- old/yast2-registration-3.1.12/src/lib/registration/sw_mgmt.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-registration-3.1.13/src/lib/registration/sw_mgmt.rb 2014-02-27 14:14:53.000000000 +0100 @@ -0,0 +1,141 @@ +# encoding: utf-8 + +# ------------------------------------------------------------------------------ +# Copyright (c) 2014 Novell, Inc. All Rights Reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, you may find +# current contact information at www.novell.com. +# ------------------------------------------------------------------------------ +# +# + +require "yast" + +require "tmpdir" +require "fileutils" + +require "registration/exceptions" + +module Registration + Yast.import "Mode" + Yast.import "Pkg" + Yast.import "Installation" + Yast.import "PackageCallbacksInit" + Yast.import "Progress" + + class SwMgmt + include Yast + include Yast::Logger + extend Yast::I18n + + textdomain "registration" + + ZYPP_DIR = "/etc/zypp" + + def self.init + # display progress when refreshing repositories + PackageCallbacksInit.InitPackageCallbacks + Pkg.TargetInitialize(Installation.destdir) + Pkg.TargetLoad + Pkg.SourceStartManager(true) + end + + # during installation /etc/zypp directory is not writable (mounted on + # a read-only file system), the workaround is to copy the whole directory + # structure into a writable temporary directory and override the original + # location by "mount -o bind" + def self.zypp_config_writable! + return if !Mode.installation || File.writable?(ZYPP_DIR) + + log.info "Copying libzypp config to a writable place" + + # create writable zypp directory structure in /tmp + tmpdir = Dir.mktmpdir + + log.info "Copying #{ZYPP_DIR} to #{tmpdir} ..." + ::FileUtils.cp_r ZYPP_DIR, tmpdir + + log.info "Mounting #{tmpdir} to #{ZYPP_DIR}" + `mount -o bind #{tmpdir}/zypp #{ZYPP_DIR}` + end + + def self.products_to_register + # just for debugging: + # return [{"name" => "SUSE_SLES", "arch" => "x86_64", "version" => "12-"}] + + # during installation the products are :selected, + # on a running system the products are :installed + products = Pkg.ResolvableProperties("", :product, "").find_all do |p| + p["status"] == :selected || p["status"] == :installed + end + + # filter out not needed data + product_info = products.map do |p| + { "name" => p["name"], "arch" => p["arch"], "version" => p["version"]} + end + + log.info("Products to register: #{product_info}") + + product_info + end + + # add the services to libzypp and load (refresh) them + def self.add_services(product_services, credentials) + # save repositories before refreshing added services (otherwise + # pkg-bindings will treat them as removed by the service refresh and + # unload them) + if !Pkg.SourceSaveAll + # error message + raise Registration::PkgError, N_("Saving repository configuration failed.") + end + + # services for registered products + services = product_services.map &:services + + services.each do |service| + log.info "Adding service #{service.name.inspect} (#{service.url})" + + # progress bar label + Progress.Title(_("Adding service %s...") % service.name) + + # TODO FIXME: SCC currenly does not return credentials for the service, + # just reuse the global credentials and save to a different file + credentials.file = service.name + "_credentials" + credentials.write + + if !Pkg.ServiceAdd(service.name, service.url.to_s) + # error message + raise Registration::ServiceError.new(N_("Adding service '%s' failed."), service.name) + end + # refresh works only for saved services + if !Pkg.ServiceSave(service.name) + # error message + raise Registration::ServiceError.new(N_("Saving service '%s' failed."), service.name) + end + + if !Pkg.ServiceRefresh(service.name) + # error message + raise Registration::ServiceError.new(N_("Refreshing service '%s' failed."), service.name) + end + + Progress.NextStep + end + ensure + Pkg.SourceSaveAll + end + + end +end + continue with "q"... Checked in at Thu Feb 27 16:16:01 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