Skip to content

Commit

Permalink
Merge pull request #424 from SUSE/workaround_initial_packagehub_repo_…
Browse files Browse the repository at this point in the history
…refresh_failure

fix packagehub activation
  • Loading branch information
digitaltom committed Sep 26, 2019
2 parents 4f82c3a + 22f5cfa commit 8408c61
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/suse/connect/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module SUSE
module Connect
VERSION = '0.3.20'
VERSION = '0.3.21'
end
end
8 changes: 7 additions & 1 deletion lib/suse/connect/zypper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions package/SUSEConnect.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Sep 26 09:53:36 UTC 2019 - Thomas Schmidt <tschmidt@suse.com>

- 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 <ikapelyukhin@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/SUSEConnect.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
12 changes: 10 additions & 2 deletions spec/connect/zypper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8408c61

Please sign in to comment.