commit SUSEConnect for openSUSE:Factory
Hello community, here is the log from the commit of package SUSEConnect for openSUSE:Factory checked in at 2018-04-26 13:31:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/SUSEConnect (Old) and /work/SRC/openSUSE:Factory/.SUSEConnect.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "SUSEConnect" Thu Apr 26 13:31:18 2018 rev:10 rq:600683 version:0.3.10 Changes: -------- --- /work/SRC/openSUSE:Factory/SUSEConnect/SUSEConnect.changes 2018-03-16 10:35:01.590453555 +0100 +++ /work/SRC/openSUSE:Factory/.SUSEConnect.new/SUSEConnect.changes 2018-04-26 13:31:19.674818022 +0200 @@ -1,0 +2,15 @@ +Thu Apr 19 14:30:00 UTC 2018 - fschnizlein@suse.com + +- Update to 0.3.10 + - Fix rollback mechanism on SLE15 systems (bsc#1089320) + + +------------------------------------------------------------------- +Thu Apr 5 13:25:00 UTC 2018 - wstephenson@suse.com + +- Update to 0.3.9 + - Enable access to package search via gem + - Don't try to delete directory of nonexistent service files + (bsc#1086420) + +------------------------------------------------------------------- Old: ---- suse-connect-0.3.8.gem New: ---- suse-connect-0.3.10.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ SUSEConnect.spec ++++++ --- /var/tmp/diff_new_pack.LsMtoz/_old 2018-04-26 13:31:20.218798094 +0200 +++ /var/tmp/diff_new_pack.LsMtoz/_new 2018-04-26 13:31:20.222797948 +0200 @@ -16,11 +16,14 @@ # Name: SUSEConnect -Version: 0.3.8 +Version: 0.3.10 Release: 0 %define mod_name suse-connect %define mod_full_name %{mod_name}-%{version} +# Does not build for i586 and s390 and is not supported on those architectures +ExcludeArch: %ix86 s390 + Requires: coreutils, util-linux, net-tools, hwinfo, zypper, ca-certificates-mozilla Requires: zypper(auto-agree-with-product-licenses) %ifarch x86_64 aarch64 ++++++ SUSEConnect.5 ++++++ --- /var/tmp/diff_new_pack.LsMtoz/_old 2018-04-26 13:31:20.246797068 +0200 +++ /var/tmp/diff_new_pack.LsMtoz/_new 2018-04-26 13:31:20.250796922 +0200 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "SUSECONNECT" "5" "March 2017" "" "SUSEConnect" +.TH "SUSECONNECT" "5" "April 2017" "" "SUSEConnect" . .SH "NAME" \fBSUSEConnect\fR \- SUSE Customer Center registration tool config file ++++++ SUSEConnect.8 ++++++ --- /var/tmp/diff_new_pack.LsMtoz/_old 2018-04-26 13:31:20.270796190 +0200 +++ /var/tmp/diff_new_pack.LsMtoz/_new 2018-04-26 13:31:20.270796190 +0200 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "SUSECONNECT" "8" "May 2017" "" "SUSEConnect" +.TH "SUSECONNECT" "8" "June 2017" "" "SUSEConnect" . .SH "NAME" \fBSUSEConnect\fR \- SUSE Customer Center registration tool ++++++ suse-connect-0.3.8.gem -> suse-connect-0.3.10.gem ++++++ Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/api.rb new/lib/suse/connect/api.rb --- old/lib/suse/connect/api.rb 2018-03-14 15:36:57.000000000 +0100 +++ new/lib/suse/connect/api.rb 2018-04-24 12:40:15.000000000 +0200 @@ -1,4 +1,5 @@ require 'optparse' +require 'cgi' module SUSE module Connect @@ -14,16 +15,16 @@ # Returns a new instance of SUSE::Connect::Api # - # @param client [SUSE::Connect::Client] client instance + # @param config [SUSE::Connect::Config] config instance # @return [SUSE::Connect::Api] api object to call SCC API - def initialize(client) - @client = client + def initialize(config) + @config = config @connection = Connection.new( - client.config.url, - language: client.config.language, - insecure: client.config.insecure, - verify_callback: client.config.verify_callback, - debug: client.config.debug + config.url, + language: config.language, + insecure: config.insecure, + verify_callback: config.verify_callback, + debug: config.debug ) end @@ -98,7 +99,7 @@ version: product.version, arch: product.arch, release_type: product.release_type, - token: @client.config.token, + token: @config.token, email: email } @connection.post('/connect/systems/products', auth: auth, params: payload) @@ -230,6 +231,20 @@ def list_installer_updates(product) @connection.get('/connect/repositories/installer', params: product.to_params) end + + # Search packages which are available in the product of the base product + # + # @param product [SUSE::Connect::Zypper::Product] the product for in which product tree should be searched + # @param query [String] The package query to search + # + # @return [Array< <Hash>>] of all matched packages available + def package_search(product, query) + api = '/api/package_search/packages' + triplet = CGI.escape(product.to_triplet) + query = CGI.escape(query) + + @connection.get(api + "?product_id=#{triplet}&query=#{query}") + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/cli.rb new/lib/suse/connect/cli.rb --- old/lib/suse/connect/cli.rb 2018-03-14 15:36:57.000000000 +0100 +++ new/lib/suse/connect/cli.rb 2018-04-24 12:40:15.000000000 +0200 @@ -16,7 +16,7 @@ @config = Config.new.merge!(@options) end - def execute! # rubocop:disable MethodLength, CyclomaticComplexity + def execute! # rubocop:disable MethodLength, CyclomaticComplexity, PerceivedComplexity, AbcSize # check for parameter dependencies if @config.status status.print_product_statuses(:json) @@ -26,6 +26,8 @@ Client.new(@config).deregister! elsif @config.cleanup System.cleanup! + elsif @config.rollback + Migration.rollback elsif @config.list_extensions if status.activated_base_product? status.print_extensions_list @@ -187,9 +189,7 @@ @opts.on('--rollback', 'Revert the registration state in case of a failed', 'migration.') do |_opt| - log.info('> Beginning registration rollback. This can take some time...') - SUSE::Connect::Migration.rollback - exit 0 + @options[:rollback] = true end @opts.separator '' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/client.rb new/lib/suse/connect/client.rb --- old/lib/suse/connect/client.rb 2018-03-14 15:36:57.000000000 +0100 +++ new/lib/suse/connect/client.rb 2018-04-24 12:40:15.000000000 +0200 @@ -17,7 +17,7 @@ # @return [Client] def initialize(config) @config = config - @api = Api.new(self) + @api = Api.new(@config) log.debug "Merged options: #{@config}" end @@ -46,11 +46,8 @@ service = activate_product(product, @config.email) System.add_service(service) + Zypper.install_release_package(product.identifier) if install_release_package - if install_release_package - Zypper.refresh_services - Zypper.install_release_package(product.identifier) - end print_success_message(product) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/migration.rb new/lib/suse/connect/migration.rb --- old/lib/suse/connect/migration.rb 2018-03-14 15:36:57.000000000 +0100 +++ new/lib/suse/connect/migration.rb 2018-04-24 12:40:15.000000000 +0200 @@ -18,27 +18,35 @@ # Restores a state of the system before migration def rollback(client_params = {}) + log.info('Starting to sync system product activations to the server. This can take some time...') config = SUSE::Connect::Config.new.merge!(client_params) client = Client.new(config) status = Status.new(config) + base_product = Zypper.base_product - # FIXME: Sort products and ensure the base product is the first one in the list - status.installed_products.sort_by { |p| p.isbase ? 0 : 1 }.each do |product| - service = client.downgrade_product(product) - # INFO: Remove old and new service because this could be called after filesystem rollback or - # from inside a failed migration - remove_service service.name - remove_service service.obsoleted_service_name - - # INFO: Add new service for the same product but with new/valid service url - add_service service.url, service.name + # First rollback the base_product + service = client.downgrade_product(base_product) + refresh_service service + + # Fetch the product tree an get all installed products in right order + installed = Hash[status.installed_products.collect { |p| [p.identifier, p] }] + tree = client.show_product(base_product) + + extensions = client.flatten_tree(tree).select do |extension| + installed.include? extension.identifier + end.map(&:identifier) + + # Rollback all extensions + extensions.each do |extension| + service = client.downgrade_product(installed[extension]) + refresh_service service end # Synchronize installed products with SCC activations (removes obsolete activations) client.synchronize(status.installed_products) # Set releasever to the new baseproduct version - target_version = status.installed_products.find(&:isbase).version + target_version = base_product.version.to_s SUSE::Connect::Zypper.set_release_version(target_version) end @@ -89,6 +97,18 @@ def install_release_package(identifier) SUSE::Connect::Zypper.install_release_package(identifier) end + + # Removes service an readds service with current url and name + # @param Service service which should be refreshed + def refresh_service(service) + # INFO: Remove old and new service because this could be called after filesystem rollback or + # from inside a failed migration + remove_service service.name + remove_service service.obsoleted_service_name + + # INFO: Add new service for the same product but with new/valid service url + add_service service.url, service.name + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/package_search.rb new/lib/suse/connect/package_search.rb --- old/lib/suse/connect/package_search.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/suse/connect/package_search.rb 2018-04-24 12:40:15.000000000 +0200 @@ -0,0 +1,24 @@ +module SUSE + module Connect + # Enable connect and zypper extensions/scripts to search packages for a + # certain product + class PackageSearch + class << self + # Search packages depending on the product and its extension/module + # tree. + # + # @param query [String] package to search + # @param product [SUSE::Connect::Zypper::Product] product to base search on + # @param config_params [<Hash>] overwrites from the config file + # + # @return [Array< <Hash>>] Returns all matched packages or an empty array if no matches where found + def search(query, product: Zypper.base_product, config_params: {}) + config = SUSE::Connect::Config.new.merge!(config_params) + api = SUSE::Connect::Api.new(config) + + api.package_search(product, query).body['data'] + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/remote/product.rb new/lib/suse/connect/remote/product.rb --- old/lib/suse/connect/remote/product.rb 2018-03-14 15:36:57.000000000 +0100 +++ new/lib/suse/connect/remote/product.rb 2018-04-24 12:40:15.000000000 +0200 @@ -24,6 +24,10 @@ } end + def to_triplet + "#{identifier}/#{version}/#{arch}" + end + # This method is needed to compute the distro_target when /etc/products.d/baseproduct # does not exist. This happens e.g. when creating a rootfs from scratch. def distro_target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/version.rb new/lib/suse/connect/version.rb --- old/lib/suse/connect/version.rb 2018-03-14 15:36:57.000000000 +0100 +++ new/lib/suse/connect/version.rb 2018-04-24 12:40:15.000000000 +0200 @@ -1,6 +1,6 @@ module SUSE # Provides access to version number of a gem module Connect - VERSION = '0.3.8' + VERSION = '0.3.10' end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/zypper/product.rb new/lib/suse/connect/zypper/product.rb --- old/lib/suse/connect/zypper/product.rb 2018-03-14 15:36:57.000000000 +0100 +++ new/lib/suse/connect/zypper/product.rb 2018-04-24 12:40:15.000000000 +0200 @@ -22,6 +22,10 @@ } end + def to_triplet + "#{identifier}/#{version}/#{arch}" + end + private def determine_release_type(product_hash) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/zypper.rb new/lib/suse/connect/zypper.rb --- old/lib/suse/connect/zypper.rb 2018-03-14 15:36:57.000000000 +0100 +++ new/lib/suse/connect/zypper.rb 2018-04-24 12:40:15.000000000 +0200 @@ -176,7 +176,7 @@ def remove_service_credentials(service_name) service_credentials_file = File.join(SUSE::Connect::Credentials::DEFAULT_CREDENTIALS_DIR, service_name) - if File.exist?(service_credentials_file) + if File.file?(service_credentials_file) File.delete service_credentials_file end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect.rb new/lib/suse/connect.rb --- old/lib/suse/connect.rb 2018-03-14 15:36:57.000000000 +0100 +++ new/lib/suse/connect.rb 2018-04-24 12:40:15.000000000 +0200 @@ -17,6 +17,7 @@ require 'suse/connect/hwinfo/base' require 'suse/connect/product' require 'suse/connect/migration' + require 'suse/connect/package_search' require 'suse/connect/yast' # Holding all the object classes received from registration server diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2018-03-14 15:36:57.000000000 +0100 +++ new/metadata 2018-04-24 12:40:15.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: suse-connect version: !ruby/object:Gem::Version - version: 0.3.8 + version: 0.3.10 platform: ruby authors: - SUSE Customer Center Team autorequire: bindir: bin cert_chain: [] -date: 2018-03-14 00:00:00.000000000 Z +date: 2018-04-24 00:00:00.000000000 Z dependencies: [] description: This package provides a command line tool and rubygem library for connecting a client system to the SUSE Customer Center. It will connect the system to your @@ -39,6 +39,7 @@ - lib/suse/connect/hwinfo/x86.rb - lib/suse/connect/logger.rb - lib/suse/connect/migration.rb +- lib/suse/connect/package_search.rb - lib/suse/connect/product.rb - lib/suse/connect/remote/activation.rb - lib/suse/connect/remote/product.rb
participants (1)
-
root@hilbert.suse.de