Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix packagehub activation #424

Merged
merged 3 commits into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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