Hello community, here is the log from the commit of package SUSEConnect for openSUSE:Factory checked in at 2018-01-24 15:24:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/SUSEConnect (Old) and /work/SRC/openSUSE:Factory/.SUSEConnect.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "SUSEConnect" Wed Jan 24 15:24:54 2018 rev:7 rq:568578 version:0.3.7 Changes: -------- --- /work/SRC/openSUSE:Factory/SUSEConnect/SUSEConnect.changes 2017-12-10 18:14:57.098320282 +0100 +++ /work/SRC/openSUSE:Factory/.SUSEConnect.new/SUSEConnect.changes 2018-01-24 15:24:55.238031942 +0100 @@ -1,0 +2,29 @@ +Tue Jan 23 13:27:08 UTC 2018 - fschuel...@suse.com + +- Remove unnecessary .gz files + +------------------------------------------------------------------- +Thu Jan 18 14:54:57 UTC 2018 - fschuel...@suse.com + +- Update to 0.3.7 + - virt-create-rootfs connects to SMT server without breaking (bsc#914297) + +------------------------------------------------------------------- +Thu Dec 28 13:29:20 UTC 2017 - hschm...@suse.com + +- Update to 0.3.6 + - Make target_base_product parameter mandatory. + +------------------------------------------------------------------- +Mon Dec 18 14:56:58 UTC 2017 - hschm...@suse.com + +- Update to 0.3.5 + - Add YaST.system_offline_migrations + +------------------------------------------------------------------- +Thu Dec 14 09:01:58 UTC 2017 - tschm...@suse.com + +- Update to version 0.3.4: + - Packaging improvements (bsc#964013) + +------------------------------------------------------------------- Old: ---- SUSEConnect.5.gz SUSEConnect.8.gz suse-connect-0.3.3.gem New: ---- SUSEConnect.5 SUSEConnect.8 suse-connect-0.3.7.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ SUSEConnect.spec ++++++ --- /var/tmp/diff_new_pack.2yQT7N/_old 2018-01-24 15:24:55.925999762 +0100 +++ /var/tmp/diff_new_pack.2yQT7N/_new 2018-01-24 15:24:55.925999762 +0100 @@ -16,7 +16,7 @@ # Name: SUSEConnect -Version: 0.3.3 +Version: 0.3.7 Release: 0 %define mod_name suse-connect %define mod_full_name %{mod_name}-%{version} @@ -28,8 +28,12 @@ %endif Conflicts: suseRegister, yast2-registration < 3.1.129.7 -# At some point we had a seperate rubygem-suse-connect package, which we need to obsolete +# In SLE12 GA we had a seperate rubygem-suse-connect package, which we need to obsolete now +%if (0%{?sle_version} > 0 && 0%{?sle_version} < 150000) Obsoletes: ruby2.1-rubygem-suse-connect < %{version} +Provides: ruby2.1-rubygem-suse-connect = %{version} +%endif + %define ruby_version %{rb_default_ruby_suffix} # FIXME: For some reason, on SLE15 %{rb_default_ruby_suffix} resolves to ruby2.4 which does not exist there @@ -43,14 +47,14 @@ Url: https://github.com/SUSE/connect Source: %{mod_full_name}.gem -Source1: %{name}.5.gz -Source2: %{name}.8.gz +Source1: %{name}.5 +Source2: %{name}.8 Source3: %{name}.example Summary: Utility to register a system with the SUSE Customer Center License: LGPL-2.1 Group: System/Management -PreReq: update-alternatives +Requires(post): update-alternatives %description This package provides a command line tool and rubygem library for connecting a @@ -70,8 +74,8 @@ mv %{buildroot}%{_bindir}/%{name}.%{ruby_version} %{buildroot}%{_sbindir}/%{name} ln -s %{_sbindir}/%{name} %{buildroot}%{_bindir}/%{name} -install -D -m 644 %_sourcedir/SUSEConnect.5.gz %{buildroot}%_mandir/man5/SUSEConnect.5.gz -install -D -m 644 %_sourcedir/SUSEConnect.8.gz %{buildroot}%_mandir/man8/SUSEConnect.8.gz +install -D -m 644 %_sourcedir/SUSEConnect.5 %{buildroot}%_mandir/man5/SUSEConnect.5 +install -D -m 644 %_sourcedir/SUSEConnect.8 %{buildroot}%_mandir/man8/SUSEConnect.8 install -D -m 644 %_sourcedir/SUSEConnect.example %{buildroot}%_sysconfdir/SUSEConnect.example touch %{buildroot}%_sysconfdir/SUSEConnect @@ -95,7 +99,7 @@ # remove stale update-alternatives config left by previous split, versioned packaging of SUSEConnect if update-alternatives --config SUSEConnect &> /dev/null ; then - update-alternatives --quiet --remove-all SUSEConnect + update-alternatives --force --quiet --remove-all SUSEConnect ln -fs ../sbin/%{name} %{_bindir}/%{name} fi @@ -107,8 +111,8 @@ %{gem_base}/cache/%{mod_full_name}.gem %{gem_base}/specifications/%{mod_full_name}.gemspec -%doc %{_mandir}/man5/SUSEConnect.5.gz -%doc %{_mandir}/man8/SUSEConnect.8.gz +%doc %{_mandir}/man5/SUSEConnect.5.* +%doc %{_mandir}/man8/SUSEConnect.8.* %config(noreplace) %ghost %{_sysconfdir}/SUSEConnect %config %{_sysconfdir}/SUSEConnect.example ++++++ SUSEConnect.5 ++++++ --- /var/tmp/diff_new_pack.2yQT7N/_old 2018-01-24 15:24:55.957998266 +0100 +++ /var/tmp/diff_new_pack.2yQT7N/_new 2018-01-24 15:24:55.957998266 +0100 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "SUSECONNECT" "5" "February 2017" "" "SUSEConnect" +.TH "SUSECONNECT" "5" "March 2017" "" "SUSEConnect" . .SH "NAME" \fBSUSEConnect\fR \- SUSE Customer Center registration tool config file ++++++ SUSEConnect.8 ++++++ +++ empty output from diff against SUSEConnect.8.gz ++++++ SUSEConnect.example ++++++ --- /var/tmp/diff_new_pack.2yQT7N/_old 2018-01-24 15:24:56.013995647 +0100 +++ /var/tmp/diff_new_pack.2yQT7N/_new 2018-01-24 15:24:56.017995459 +0100 @@ -4,9 +4,6 @@ ## URL of the registration server. (default: https://scc.suse.com) # url: https://scc.suse.com -## Registration code to use for the base product on the system -# regcode: - ## Language code to use for error messages (default: $LANG) # language: ++++++ suse-connect-0.3.3.gem -> suse-connect-0.3.7.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2017-12-07 18:28:01.000000000 +0100 +++ new/README.md 2018-01-18 15:59:05.000000000 +0100 @@ -1,21 +1,24 @@ [](https://travis-ci.org/SUSE/connect) +[](https://gemnasium.com/SUSE/connect) [](https://codeclimate.com/github/SUSE/connect) [](https://coveralls.io/r/SUSE/connect) -#SUSEConnect +# SUSEConnect -is a command line tool for connecting a client system to the SUSE Customer Center. +SUSEConnect is a command line tool for connecting a client system to the SUSE Customer Center. It will connect the system to your product subscriptions and enable the product repositories/services locally. +SUSEConnect is distributed as RPM for all SUSE distributions and gets built in +the [openSUSE build service](https://build.opensuse.org/package/show/systemsmanagement:SCC/SUSEConnect). + Please visit https://scc.suse.com to see and manage your subscriptions. -# Rake tasks +SUSEConnect communicates with SCC over this [REST API](https://github.com/SUSE/connect/blob/master/doc/SCC-API-%28Implemented%29.md). -NOTE: If you are using RVM/Chruby/rbenv - make sure you installed gem2rpm as the package to the system itself and -using it for `rake build` +# Rake tasks ``` -rake build # build locally (prepare for pushing to ibs) +rake build # build locally (see PACKAGE.md for details) rake bump # increase version of a gem rake console # Run console loaded with gem rake rubocop # Run Rubocop @@ -24,7 +27,7 @@ # Docker usage -Build an image (and everytime you change code) +## Build an image (and everytime you change code) For SLES12SP0 @@ -32,28 +35,34 @@ For SLES12SP1 -* `docker build -t connect_sp1 -f Dockerfile.sp1 .` +* `docker build -t connect.sp1 -f Dockerfile.sp1 .` For SLES12SP2 -* `docker build -t connect_sp2 -f Dockerfile.sp2 .` +* `docker build -t connect.sp2 -f Dockerfile.sp2 .` For SLES12SP3 -* `docker build -t connect_sp3 -f Dockerfile.sp3 .` +* `docker build -t connect.sp3 -f Dockerfile.sp3 .` + +## Run commands + +Open a console + +* `docker run --privileged --rm -ti connect /bin/bash` -Run RSpec +Run RSpec * `docker run --privileged --rm -t connect su nobody -c rspec` -Run Cucumber +Run Cucumber * `docker run --privileged --rm -t connect cucumber` -Run Rubocop +Run Rubocop * `docker run --privileged --rm -t connect su nobody -c rubocop` -Or run whole set of tests together +Or run whole set of tests together * `docker run --privileged --rm -t connect sh docker/runall.sh` 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 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/api.rb 2018-01-18 15:59:05.000000000 +0100 @@ -205,12 +205,21 @@ # @param auth [String] authorization string which will be injected in 'Authorization' header in request. # In this case we expect Base64 encoded string with login and password # @param [Array <Remote::Product>] a list of producs + # @param target_base_product [Remote::Product] (optional) a target base + # product to upgrade to. Only used by the backend when kind is :offline. Defaults to nil. + # @param kind [Symbol] (optional) :online or :offline. It specifies whether + # the online or the offline migrations are desired. Defaults to :online. # # @return [Array <Array <Hash>>] the list of possible upgrade paths for the given products, # where each product is represented by a hash with identifier, version, arch and release_type - def system_migrations(auth, products) + def system_migrations(auth, products, target_base_product: nil, kind:) payload = { installed_products: products.map(&:to_params) } - @connection.post('/connect/systems/products/migrations', auth: auth, params: payload) + payload[:target_base_product] = target_base_product.to_params if target_base_product + endpoints = { + online: '/connect/systems/products/migrations', + offline: '/connect/systems/products/offline_migrations' + } + @connection.post(endpoints.fetch(kind), auth: auth, params: payload) end # List available Installer-Updates repositories for the given product 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 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/cli.rb 2018-01-18 15:59:05.000000000 +0100 @@ -4,7 +4,7 @@ module SUSE module Connect # Command line interface for interacting with SUSEConnect - class Cli # rubocop:disable ClassLength + class Cli # rubocop:disable ClassLength include Logger attr_reader :config, :options @@ -49,7 +49,6 @@ end @config.write! if @config.write_config - rescue Errno::ECONNREFUSED log.fatal "Error: Connection refused by server #{@config.url}" exit 64 @@ -115,6 +114,8 @@ '<internal name>/<version>/<architecture>. You can find these values by calling: ' \ '\'SUSEConnect --list-extensions\'. ') identifier, version, arch = opt.split('/') + require 'byebug' + byebug @options[:product] = Remote::Product.new(identifier: identifier, version: version, arch: arch) end 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 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/client.rb 2018-01-18 15:59:05.000000000 +0100 @@ -140,11 +140,16 @@ # Lists all available upgrade paths for a given list of products # # @param [Array <Remote::Product>] the list of currently installed products in the system + # @param kind [Symbol] :online or :offline. Whether to get online or offline migrations. + # @param target_base_product [Remote::Product] (optional) Filter the resulting migration paths for the given base product. + # Only used by the backend when kind is :offline. # # @return [Array <Array <Remote::Product>>] the list of possible upgrade paths for the given products, # where an upgrade path is an array of Remote::Product objects. - def system_migrations(products) - upgrade_paths = @api.system_migrations(system_auth, products).body + def system_migrations(products, target_base_product: nil, kind:) + args = { kind: kind, target_base_product: target_base_product }.reject { |_, v| v.nil? } + + upgrade_paths = @api.system_migrations(system_auth, products, args).body upgrade_paths.map do |upgrade_path| upgrade_path.map do |product_attributes| Remote::Product.new(product_attributes) @@ -169,7 +174,9 @@ if registered? update_system else - login, password = announce_system(nil, @config.instance_data_file) + distro_target = @config.product ? @config.product.distro_target : nil + login, password = announce_system(distro_target, + @config.instance_data_file) Credentials.new(login, password, Credentials.system_credentials_file).write end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/config.rb new/lib/suse/connect/config.rb --- old/lib/suse/connect/config.rb 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/config.rb 2018-01-18 15:59:05.000000000 +0100 @@ -39,7 +39,7 @@ end def select_serializable_attributes - to_hash_with_string_keys.select {|key, _| self.class.serializable.include?(key.to_sym) } + to_hash_with_string_keys.select { |key, _| self.class.serializable.include?(key.to_sym) } end # allows to merge hash from other source into config to maintain precedence @@ -60,7 +60,7 @@ def to_hash_with_string_keys # OK, this code maybe look quite magic, but in fact it takes hash from # to_h and create new one with keys that is converted with to_s - Hash[to_h.map {|k, v| [k.to_s, v] }] + Hash[to_h.map { |k, v| [k.to_s, v] }] end def read diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/connection.rb new/lib/suse/connect/connection.rb --- old/lib/suse/connect/connection.rb 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/connection.rb 2018-01-18 15:59:05.000000000 +0100 @@ -10,10 +10,10 @@ include Logger VERB_TO_CLASS = { - :get => Net::HTTP::Get, - :post => Net::HTTP::Post, - :put => Net::HTTP::Put, - :delete => Net::HTTP::Delete + get: Net::HTTP::Get, + post: Net::HTTP::Post, + put: Net::HTTP::Put, + delete: Net::HTTP::Delete } attr_accessor :debug, :http, :auth, :language @@ -53,7 +53,7 @@ private def json_request(method, path, params = {}) - request = VERB_TO_CLASS[method].new(path) + request = VERB_TO_CLASS[method].new(path) add_headers(request) request.body = params.to_json unless params.empty? @@ -66,7 +66,6 @@ body: body, success: response.is_a?(Net::HTTPSuccess) ) - rescue Zlib::Error raise SUSE::Connect::NetworkError, 'Check your network connection and try again. If it keeps failing, report a bug.' end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/credentials.rb new/lib/suse/connect/credentials.rb --- old/lib/suse/connect/credentials.rb 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/credentials.rb 2018-01-18 15:59:05.000000000 +0100 @@ -52,7 +52,7 @@ FileUtils.mkdir_p(dirname) unless File.exist?(dirname) log.debug("Writing credentials to #{filename}") log.debug("Credentials to write: #{self}") - File.write(filename, serialize, :perm => 0600) + File.write(filename, serialize, perm: 0600) end # security - override to_s to avoid writing the password to log @@ -87,7 +87,7 @@ raise MalformedSccCredentialsFile, 'Cannot parse credentials file' end - [user, passwd] + [user, passwd] end # serialize the credentials for writing to a file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/hwinfo/s390.rb new/lib/suse/connect/hwinfo/s390.rb --- old/lib/suse/connect/hwinfo/s390.rb 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/hwinfo/s390.rb 2018-01-18 15:59:05.000000000 +0100 @@ -43,7 +43,7 @@ private def output - @output ||= Hash[execute('read_values -s', false).split("\n").map {|line| line.split(':') }] + @output ||= Hash[execute('read_values -s', false).split("\n").map { |line| line.split(':') }] end end 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 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/migration.rb 2018-01-18 15:59:05.000000000 +0100 @@ -23,7 +23,7 @@ status = Status.new(config) # 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| + 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 @@ -59,7 +59,7 @@ def repositories # INFO: use block instead of .map(&:to_openstruct) see https://bugs.ruby-lang.org/issues/9786 # rubocop:disable SymbolProc - SUSE::Connect::Zypper.repositories.map {|r| r.to_openstruct } + SUSE::Connect::Zypper.repositories.map { |r| r.to_openstruct } end # Forwards the service which should be added with zypper @@ -81,7 +81,7 @@ def find_products(identifier) # INFO: use block instead of .map(&:to_openstruct) see https://bugs.ruby-lang.org/issues/9786 # rubocop:disable SymbolProc - SUSE::Connect::Zypper.find_products(identifier).map {|p| p.to_openstruct } + SUSE::Connect::Zypper.find_products(identifier).map { |p| p.to_openstruct } end # Installs the product release package 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 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/remote/product.rb 2018-01-18 15:59:05.000000000 +0100 @@ -12,7 +12,7 @@ def initialize(product_hash) super # TODO: ensure we have array here - self.extensions = extensions.map {|ext| self.class.new(ext) } if extensions + self.extensions = extensions.map { |ext| self.class.new(ext) } if extensions end def to_params @@ -23,4 +23,11 @@ release_type: release_type } end + + def distro_target + version = self.version.scan(/\d+/)[0] + identifier = self.identifier.downcase + identifier = 'sle' if (identifier =~ /^sle/) + "#{identifier}-#{version}-#{arch}" + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/status.rb new/lib/suse/connect/status.rb --- old/lib/suse/connect/status.rb 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/status.rb 2018-01-18 15:59:05.000000000 +0100 @@ -55,7 +55,7 @@ def system_products products = installed_products + activated_products - products.map {|product| Product.transform(product) }.uniq + products.map { |product| Product.transform(product) }.uniq end private @@ -69,8 +69,8 @@ activation_code: build_product_activation_code(extension), name: extension.friendly_name, free: extension.free, - installed: installed_products.any? {|p| p == extension }, - activated: activated_products.any? {|p| p == extension }, + installed: installed_products.any? { |p| p == extension }, + activated: activated_products.any? { |p| p == extension }, extensions: extract_extensions(extension) } end if product.extensions @@ -78,7 +78,7 @@ end def grouped_extensions - @grouped_extensions ||= available_system_extensions.group_by {|ext| ext[:free] } + @grouped_extensions ||= available_system_extensions.group_by { |ext| ext[:free] } end def build_product_activation_code(product) @@ -117,11 +117,11 @@ end def activations_from_server - system_activations.map {|s| Remote::Activation.new(s) } + system_activations.map { |s| Remote::Activation.new(s) } end def products_from_activations - system_activations.map {|p| Remote::Product.new(p['service']['product']) } + system_activations.map { |p| Remote::Product.new(p['service']['product']) } end def products_from_zypper @@ -129,7 +129,7 @@ end def product_statuses - installed_products.map {|p| Zypper::ProductStatus.new(p, self) } + installed_products.map { |p| Zypper::ProductStatus.new(p, self) } end def system_activations 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 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/version.rb 2018-01-18 15:59:05.000000000 +0100 @@ -1,6 +1,6 @@ module SUSE # Provides access to version number of a gem module Connect - VERSION = '0.3.3' + VERSION = '0.3.7' end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/connect/yast.rb new/lib/suse/connect/yast.rb --- old/lib/suse/connect/yast.rb 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/yast.rb 2018-01-18 15:59:05.000000000 +0100 @@ -143,19 +143,40 @@ Status.new(config).activated_products.map(&:to_openstruct) end - # Lists all available upgrade paths for a given list of products + # Lists all available online migration paths for a given list of products. # Accepts an array of products, and returns an array of possible - # upgrade paths. An upgrade path is a list of products that may + # migration paths. A migration path is a list of products that may # be upgraded. # # @param [Array <OpenStruct>] the list of currently installed {Product}s in the system # @param [Hash] client_params parameters to instantiate {Client} # - # @return [Array <Array <OpenStruct>>] the list of possible upgrade paths for the given {Product}s, - # where an upgrade path is an array of Remote::Product object. + # @return [Array <Array <OpenStruct>>] the list of possible migration paths for the given {Product}s, + # where a migration path is an array of OpenStruct objects with the attributes + # identifier, arch, version, and release_type def system_migrations(products, client_params = {}) config = SUSE::Connect::Config.new.merge!(client_params) - Client.new(config).system_migrations(products).map {|a| a.map(&:to_openstruct) } + Client.new(config).system_migrations(products, kind: :online).map { |a| a.map(&:to_openstruct) } + end + + # Lists all available offline migration paths for a given list of products. + # Accepts an array of products, and returns an array of possible + # migration paths. A migration path is a list of products that may + # be upgraded. + # + # @param installed_products [Array <OpenStruct>] the list of currently installed {Product}s in the system + # @param target_base_product [OpenStruct] the {Product} that the system wants to upgrade to + # @param client_params [Hash] parameters to instantiate {Client} + # + # @return [Array <Array <OpenStruct>>] the list of possible migration paths for the given {Product}s, + # where a migration path is an array of OpenStruct objects with the attributes + # identifier, arch, version, and release_type + def system_offline_migrations(installed_products, target_base_product, client_params = {}) + config = SUSE::Connect::Config.new.merge!(client_params) + target_base_product = Remote::Product.new(target_base_product.to_h) + args = { target_base_product: target_base_product, kind: :offline } + + Client.new(config).system_migrations(installed_products, args).map { |a| a.map(&:to_openstruct) } end # List available Installer-Updates repositories for the given product @@ -166,7 +187,7 @@ # @return [Array <OpenStruct>] list of Installer-Updates repositories def list_installer_updates(product, client_params = {}) config = SUSE::Connect::Config.new.merge!(client_params) - Client.new(config).list_installer_updates(product).map {|repo| OpenStruct.new repo } + Client.new(config).list_installer_updates(product).map { |repo| OpenStruct.new repo } end # Writes the config file with the given parameters, overwriting any existing contents 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 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/zypper/product.rb 2018-01-18 15:59:05.000000000 +0100 @@ -8,7 +8,7 @@ @identifier = product_hash[:name] @version = product_hash[:version] @arch = product_hash[:arch] - @isbase = %w{1 true yes}.include?(product_hash[:isbase]) + @isbase = %w[1 true yes].include?(product_hash[:isbase]) @release_type = determine_release_type product_hash @summary = product_hash[:summary] end 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 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/connect/zypper.rb 2018-01-18 15:59:05.000000000 +0100 @@ -52,7 +52,7 @@ zypper_out = call('--no-remote --no-refresh --xmlout --non-interactive products -i', false) xml_doc = REXML::Document.new(zypper_out, compress_whitespace: []) ary_of_products_hashes = xml_doc.root.elements['product-list'].elements.map(&:to_hash) - ary_of_products_hashes.map {|hash| Product.new(hash) } + ary_of_products_hashes.map { |hash| Product.new(hash) } end def base_product @@ -81,7 +81,7 @@ # Don't fail when zypper exits with 6 (no repositories) zypper_out = call('--xmlout --non-interactive repos -d', false, [Zypper::ExitCode::OK, Zypper::ExitCode::Error::NO_REPOS]) xml_doc = REXML::Document.new(zypper_out, compress_whitespace: []) - xml_doc.elements.to_a('stream/repo-list/repo').map {|r| r.to_hash.merge!(url: r.elements['url'].text) } + xml_doc.elements.to_a('stream/repo-list/repo').map { |r| r.to_hash.merge!(url: r.elements['url'].text) } end # @param service_url [String] url to appropriate repomd.xml to be fed to zypper diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/toolkit/cast.rb new/lib/suse/toolkit/cast.rb --- old/lib/suse/toolkit/cast.rb 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/toolkit/cast.rb 2018-01-18 15:59:05.000000000 +0100 @@ -8,7 +8,7 @@ def to_openstruct attributes = self.attributes attributes.each do |key, value| - attributes[key] = value.map {|v| v.to_openstruct } if value.is_a?(Array) && value.any? {|v| v.is_a?(Hash) } + attributes[key] = value.map { |v| v.to_openstruct } if value.is_a?(Array) && value.any? { |v| v.is_a?(Hash) } end OpenStruct.new(attributes) end @@ -16,7 +16,7 @@ def attributes attributes = to_h attributes.each do |key, value| - attributes[key] = value.map(&:to_h) if value.is_a?(Array) && value.any? {|v| v.is_a?(OpenStruct) } + attributes[key] = value.map(&:to_h) if value.is_a?(Array) && value.any? { |v| v.is_a?(OpenStruct) } end attributes end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/toolkit/curlrc_dotfile.rb new/lib/suse/toolkit/curlrc_dotfile.rb --- old/lib/suse/toolkit/curlrc_dotfile.rb 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/toolkit/curlrc_dotfile.rb 2018-01-18 15:59:05.000000000 +0100 @@ -23,6 +23,6 @@ def line_with_credentials return nil unless exist? - @line_with_credentials ||= File.readlines(@file_location).find {|l| l =~ /--proxy-user ".*:.*"/ } + @line_with_credentials ||= File.readlines(@file_location).find { |l| l =~ /--proxy-user ".*:.*"/ } end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/toolkit/system_calls.rb new/lib/suse/toolkit/system_calls.rb --- old/lib/suse/toolkit/system_calls.rb 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/toolkit/system_calls.rb 2018-01-18 15:59:05.000000000 +0100 @@ -8,7 +8,7 @@ def execute(cmd, quiet = true, valid_exit_codes = [0]) # rubocop:disable CyclomaticComplexity log.debug("Executing: '#{cmd}' Quiet: #{quiet}") - output, error, status = Open3.capture3({ 'LC_ALL' => 'C' }, cmd) {|_stdin, stdout, _stderr, _wait_thr| stdout.read } + output, error, status = Open3.capture3({ 'LC_ALL' => 'C' }, cmd) { |_stdin, stdout, _stderr, _wait_thr| stdout.read } log.debug("Output: '#{output.strip}'") unless output.empty? log.debug("Error: '#{error.strip}'") unless error.empty? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/suse/toolkit/utilities.rb new/lib/suse/toolkit/utilities.rb --- old/lib/suse/toolkit/utilities.rb 2017-12-07 18:28:01.000000000 +0100 +++ new/lib/suse/toolkit/utilities.rb 2018-01-18 15:59:05.000000000 +0100 @@ -18,7 +18,6 @@ else raise end - rescue raise SUSE::Connect::CannotBuildBasicAuth, "\nCannot read username and password from #{SUSE::Connect::Credentials.system_credentials_file}." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2017-12-07 18:28:01.000000000 +0100 +++ new/metadata 2018-01-18 15:59:05.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: suse-connect version: !ruby/object:Gem::Version - version: 0.3.3 + version: 0.3.7 platform: ruby authors: - SUSE Customer Center Team autorequire: bindir: bin cert_chain: [] -date: 2017-12-07 00:00:00.000000000 Z +date: 2018-01-18 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 @@ -83,9 +83,8 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.2.2 +rubygems_version: 2.5.1 signing_key: specification_version: 4 summary: SUSE Connect utility to register a system with the SUSE Customer Center test_files: [] -has_rdoc: