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 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/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} 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