From 9d29604c4ff4c8ed16e71008a16cab887f11d773 Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Wed, 25 Sep 2019 17:31:33 +0200 Subject: [PATCH 1/3] on initial refresh of packagehub repositories, SUSEConnect gets an error 106 from zypper because of untrusted repo signing key. this patch works around this by allowing the initial refresh to fail for this product. --- lib/suse/connect/zypper.rb | 8 +++++++- spec/connect/zypper_spec.rb | 12 ++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/suse/connect/zypper.rb b/lib/suse/connect/zypper.rb index d6503e36..916fd47b 100644 --- a/lib/suse/connect/zypper.rb +++ b/lib/suse/connect/zypper.rb @@ -156,7 +156,13 @@ def services def install_release_package(identifier) return unless identifier _, _, status = execute_raw("rpm -q #{identifier}-release") - call("--no-refresh --non-interactive install --no-recommends --auto-agree-with-product-licenses -t product #{identifier}") unless (status == 0) + valid_error_codes = [Zypper::ExitCode::OK] + # in case of packagehub we accept some repos to fail the initial refresh, because the signing key is not yet imported. + # it is part of the -release package, so the repos will be trusted after the release package is installed + valid_error_codes << Zypper::ExitCode::Info::REPOS_SKIPPED if (identifier == 'PackageHub') + unless (status == 0) + call("--no-refresh --non-interactive install --no-recommends --auto-agree-with-product-licenses -t product #{identifier}", false, valid_error_codes) + end end def remove_release_package(identifier) diff --git a/spec/connect/zypper_spec.rb b/spec/connect/zypper_spec.rb index 96ff594d..52d0c648 100644 --- a/spec/connect/zypper_spec.rb +++ b/spec/connect/zypper_spec.rb @@ -406,14 +406,22 @@ describe '.install_release_package' do context 'when the release package is not yet installed' do + let(:status_106) { double('Process Status', exitstatus: Zypper::ExitCode::Info::REPOS_SKIPPED) } it 'calls zypper install' do - expect(Open3).to receive(:capture3).with(shared_env_hash, 'rpm -q opensuse-release') - .and_return(['', '', 1]) + expect(Open3).to receive(:capture3).with(shared_env_hash, 'rpm -q opensuse-release').and_return(['', '', 1]) expect(Open3).to receive(:capture3).with(shared_env_hash, 'zypper --no-refresh --non-interactive install --no-recommends --auto-agree-with-product-licenses -t product opensuse') # rubocop:disable LineLength .and_return(['', '', status]) subject.install_release_package('opensuse') end + + it 'accepts initial repo refresh issue for PackageHub' do + expect(Open3).to receive(:capture3).with(shared_env_hash, 'rpm -q PackageHub-release').and_return(['', '', 1]) + + expect(Open3).to receive(:capture3).with(shared_env_hash, 'zypper --no-refresh --non-interactive install --no-recommends --auto-agree-with-product-licenses -t product PackageHub') # rubocop:disable LineLength + .and_return(['', 'Error building the cache', status_106]) + subject.install_release_package('PackageHub') + end end context 'when the release package is already installed' do From f24a2cddea144ce446b2bd3076b5d01025c9cd3c Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Thu, 26 Sep 2019 11:52:38 +0200 Subject: [PATCH 2/3] v0.3.21 --- lib/suse/connect/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/suse/connect/version.rb b/lib/suse/connect/version.rb index 00f30e8d..47fce01a 100644 --- a/lib/suse/connect/version.rb +++ b/lib/suse/connect/version.rb @@ -1,5 +1,5 @@ module SUSE module Connect - VERSION = '0.3.20' + VERSION = '0.3.21' end end From 22f5cfa0a3dca60c82942655517fef55206fde95 Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Thu, 26 Sep 2019 13:03:39 +0200 Subject: [PATCH 3/3] bump package version, add changelog --- package/SUSEConnect.changes | 6 ++++++ package/SUSEConnect.spec | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package/SUSEConnect.changes b/package/SUSEConnect.changes index 372bafca..866ed79f 100644 --- a/package/SUSEConnect.changes +++ b/package/SUSEConnect.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Sep 26 09:53:36 UTC 2019 - Thomas Schmidt + +- Update to 0.3.21 + Fix error on first activation of packagehub extension (bsc#1124318) + ------------------------------------------------------------------- Wed Aug 8 16:02:30 UTC 2019 - Ivan Kapelyukhin diff --git a/package/SUSEConnect.spec b/package/SUSEConnect.spec index 4ba3d613..76c96893 100644 --- a/package/SUSEConnect.spec +++ b/package/SUSEConnect.spec @@ -17,7 +17,7 @@ Name: SUSEConnect -Version: 0.3.20 +Version: 0.3.21 Release: 0 %define mod_name suse-connect %define mod_full_name %{mod_name}-%{version}