From 33bd77e957574d57da9fba2f0a66d1c7738e6b6f Mon Sep 17 00:00:00 2001 From: Luis Caparroz Date: Thu, 2 Jan 2025 09:52:46 +0100 Subject: [PATCH] Revert "Configure SUMA product tree base URL" --- config/rmt.yml | 1 - lib/rmt.rb | 2 +- lib/rmt/mirror/suma_product_tree.rb | 4 +- package/obs/rmt-server.changes | 6 --- package/obs/rmt-server.spec | 2 +- spec/lib/rmt/mirror/suma_product_tree_spec.rb | 38 +++---------------- 6 files changed, 10 insertions(+), 43 deletions(-) diff --git a/config/rmt.yml b/config/rmt.yml index e3c849bf2..6a2df5b5c 100644 --- a/config/rmt.yml +++ b/config/rmt.yml @@ -31,7 +31,6 @@ scc: mirroring: mirror_src: false dedup_method: hardlink - suma_product_tree_base_url: <%= ENV['SUMA_PRODUCT_TREE_BASE_URL'] %> http_client: verbose: false diff --git a/lib/rmt.rb b/lib/rmt.rb index e043c2ad9..a68d53a1a 100644 --- a/lib/rmt.rb +++ b/lib/rmt.rb @@ -1,5 +1,5 @@ module RMT - VERSION ||= '2.21'.freeze + VERSION ||= '2.20'.freeze DEFAULT_USER = '_rmt'.freeze DEFAULT_GROUP = 'nginx'.freeze diff --git a/lib/rmt/mirror/suma_product_tree.rb b/lib/rmt/mirror/suma_product_tree.rb index 924e2b10c..cc0f45a9f 100644 --- a/lib/rmt/mirror/suma_product_tree.rb +++ b/lib/rmt/mirror/suma_product_tree.rb @@ -3,9 +3,9 @@ class RMT::Mirror::SumaProductTree attr_reader :mirroring_base_dir, :url, :logger - def initialize(logger:, mirroring_base_dir:, url: nil) + def initialize(logger:, mirroring_base_dir:, url: FILE_URL) @mirroring_base_dir = mirroring_base_dir - @url = url || Settings.try(:mirroring).try(:suma_product_tree_base_url) || FILE_URL + @url = url @logger = logger end diff --git a/package/obs/rmt-server.changes b/package/obs/rmt-server.changes index a89738a3c..c86808f99 100644 --- a/package/obs/rmt-server.changes +++ b/package/obs/rmt-server.changes @@ -1,9 +1,3 @@ -Mon Dec 23 14:07:00 UTC 2024 - Luís Caparroz - -- Version 2.21 -* Allow users to configure the SUMA product tree base URL to download - 'product_tree.json' from host other than 'scc.suse.com'. (bsc#1234844) - ------------------------------------------------------------------- Mon Dec 23 08:03:56 UTC 2024 - Parag Jain diff --git a/package/obs/rmt-server.spec b/package/obs/rmt-server.spec index 4652e8be5..9803c0228 100644 --- a/package/obs/rmt-server.spec +++ b/package/obs/rmt-server.spec @@ -34,7 +34,7 @@ %undefine _find_debuginfo_dwz_opts Name: rmt-server -Version: 2.21 +Version: 2.20 Release: 0 Summary: Repository mirroring tool and registration proxy for SCC License: GPL-2.0-or-later diff --git a/spec/lib/rmt/mirror/suma_product_tree_spec.rb b/spec/lib/rmt/mirror/suma_product_tree_spec.rb index ca16b5e2a..e010c441d 100644 --- a/spec/lib/rmt/mirror/suma_product_tree_spec.rb +++ b/spec/lib/rmt/mirror/suma_product_tree_spec.rb @@ -12,7 +12,7 @@ let(:ref_configuration) do { relative_path: 'product_tree.json', - base_url: base_url, + base_url: described_class::FILE_URL, cache_dir: nil, base_dir: File.join(base_dir, '/suma/') } @@ -21,7 +21,11 @@ let(:base_dir) { '/tmp' } let(:downloader) { instance_double RMT::Downloader } - shared_examples 'mirror SUMA product tree' do + describe '#mirror' do + before do + allow(RMT::Downloader).to receive(:new).and_return downloader + end + it 'mirrors the product_tree file' do expect(RMT::Mirror::FileReference).to receive(:new).with(**ref_configuration) expect(downloader).to receive(:download_multi) @@ -44,34 +48,4 @@ end end end - - describe '#mirror' do - before do - allow(RMT::Downloader).to receive(:new).and_return downloader - end - - context 'with default SUMA product tree URL' do - before do - allow(Settings).to receive(:try).with(:mirroring).and_return(nil) - end - - it_behaves_like 'mirror SUMA product tree' do - let(:base_url) { 'https://scc.suse.com/suma/' } - end - end - - context 'with custom SUMA product tree URL' do - before do - allow(Settings).to receive(:try).with(:mirroring).and_return(mirroring_configuration) - allow(mirroring_configuration).to receive(:try) - .with(:suma_product_tree_base_url).and_return(base_url) - end - - let(:mirroring_configuration) { instance_double(Config::Options) } - - it_behaves_like 'mirror SUMA product tree' do - let(:base_url) { 'http://localhost:3000/suma/' } - end - end - end end