From c2f30af04fcd0db9809dc3fe3a8644ba3935e5e7 Mon Sep 17 00:00:00 2001 From: Jesus Bermudez Velazquez Date: Wed, 4 Sep 2024 11:06:07 +0100 Subject: [PATCH] Update the product serializer Before LTSS, the product serializer returned true for the free field of any product That is no longer true in the Public Cloud scenario, where LTSS is not free This Fixes that case --- app/serializers/v3/product_serializer.rb | 5 ++++- .../api/connect/v3/systems/products_controller_spec.rb | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/serializers/v3/product_serializer.rb b/app/serializers/v3/product_serializer.rb index d0ccea8b4..90747f838 100644 --- a/app/serializers/v3/product_serializer.rb +++ b/app/serializers/v3/product_serializer.rb @@ -33,8 +33,11 @@ def eula_url end def free - # Everything is free on RMT :-) + # Everything is free on RMT :-) outside of the Public Cloud (i.e. LTSS) # Otherwise Yast and SUSEConnect will request a regcode when activating an extension + # FIXME + return object.free if defined?(SccProxy::Engine) && object.extension? + true end diff --git a/engines/instance_verification/spec/requests/api/connect/v3/systems/products_controller_spec.rb b/engines/instance_verification/spec/requests/api/connect/v3/systems/products_controller_spec.rb index 3a002f4d1..6d6e15d97 100644 --- a/engines/instance_verification/spec/requests/api/connect/v3/systems/products_controller_spec.rb +++ b/engines/instance_verification/spec/requests/api/connect/v3/systems/products_controller_spec.rb @@ -540,6 +540,7 @@ context 'when no regcode is provided' do it 'activates the product' do data = JSON.parse(response.body) + expect(data['product']['free']).to eq(false) expect(data['id']).to eq(product.id) end end