Skip to content

Commit

Permalink
Merge pull request #1271 from SUSE/fix-cleanup-ltss
Browse files Browse the repository at this point in the history
Send auth headers when de registering a product on SCC
  • Loading branch information
digitaltom authored Jan 14, 2025
2 parents 9444e3f + 1c9a51e commit 29ccf26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion engines/scc_proxy/lib/scc_proxy/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def scc_deactivate_product
elsif @system.hybrid? && @product.extension?
# check if product is on SCC and
# if it is -> de-activate it
scc_hybrid_system_activations = SccProxy.get_scc_activations(headers, @system)
scc_hybrid_system_activations = SccProxy.get_scc_activations(request.headers, @system)
if scc_hybrid_system_activations.map { |act| act['service']['product']['id'] == @product.id }.present?
# if product is found on SCC, regardless of the state
# it is OK to remove it from SCC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,15 @@
let(:scc_systems_activations_url) { 'https://scc.suse.com/connect/systems/activations' }

before do
stub_request(:get, scc_systems_activations_url).to_return(status: 401, body: "{\"error\": \"Error\'\"}", headers: {})
stub_request(:get, scc_systems_activations_url).to_return(status: 401, body: "{\"error\": \"Error\'\"}", headers: headers)
allow(SccProxy).to receive(:headers)
delete url, params: payload, headers: headers
end

it 'reports an error' do
data = JSON.parse(response.body)
expect(data['error']).to eq("{\"error\": \"Error'\"}")
expect(SccProxy).to have_received(:headers).with(headers['HTTP_AUTHORIZATION'], nil)
end
end

Expand Down

0 comments on commit 29ccf26

Please sign in to comment.