Skip to content

Commit 9ec6a0b

Browse files
authored
Merge pull request #443 from SUSE/remove-beta-from-friendly_name
Migration target display with RMT contains release stage
2 parents bb75ba2 + 0f3837d commit 9ec6a0b

File tree

9 files changed

+40
-5
lines changed

9 files changed

+40
-5
lines changed

app/models/product.rb

+4
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ def product_string
9595
[identifier, version, arch].join('/')
9696
end
9797

98+
def friendly_name
99+
[name, friendly_version, release_type, (arch if arch != 'unknown')].compact.join(' ')
100+
end
101+
98102
def change_repositories_mirroring!(conditions, mirroring_enabled)
99103
repos = repositories.where(conditions)
100104
repo_names = repos.pluck(:name)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class RemoveFriendlyNameFromProducts < ActiveRecord::Migration[5.1]
2+
def change
3+
remove_column :products, :friendly_name, :string
4+
end
5+
end

db/schema.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 20190320120959) do
13+
ActiveRecord::Schema.define(version: 20190717114051) do
1414

1515
create_table "activations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
1616
t.bigint "service_id", null: false
@@ -56,7 +56,6 @@
5656
create_table "products", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
5757
t.string "name"
5858
t.text "description"
59-
t.string "friendly_name"
6059
t.string "shortname"
6160
t.string "former_identifier"
6261
t.string "product_type"

lib/rmt.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module RMT
2-
VERSION ||= '2.3.2'.freeze
2+
VERSION ||= '2.3.3'.freeze
33

44
DEFAULT_USER = '_rmt'.freeze
55
DEFAULT_GROUP = 'nginx'.freeze

package/obs/rmt-server.changes

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
-------------------------------------------------------------------
2+
Wed Jul 24 08:19:18 UTC 2019 - Leon Schroeder <lschroeder@suse.com>
3+
4+
- Version 2.3.3
5+
- Removed release stage from names to be consistent with SCC (bsc#1136168)
6+
* Generate friendly_name as needed
7+
* Drops friendly_name column from database
8+
19
-------------------------------------------------------------------
210
Thu Jul 18 08:13:11 UTC 2019 - Ivan Kapelyukhin <ikapelyukhin@suse.com>
311

package/obs/rmt-server.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
%define ruby_version %{rb_default_ruby_suffix}
2626

2727
Name: rmt-server
28-
Version: 2.3.2
28+
Version: 2.3.3
2929
Release: 0
3030
Summary: Repository mirroring tool and registration proxy for SCC
3131
License: GPL-2.0-or-later

spec/factories/products.rb

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
sequence(:identifier) { |n| "product-#{n}" }
55
sequence(:cpe) { |n| "cpe:/o:product:#{n}" }
66
sequence(:shortname) { |n| "Product #{n}" }
7-
sequence(:friendly_name) { |n| "Product #{n}" }
87
sequence(:product_class) { |n| n.to_s.ljust(5, 'A') }
98
free false
109
product_type :base

spec/models/product_spec.rb

+11
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@
128128
end
129129
end
130130

131+
describe '#friendly_name' do
132+
subject { create(:product, product_attrs).friendly_name }
133+
134+
let(:product_attrs) { { name: 'Dummy Product', friendly_version: '99', release_type: 'Bar', arch: 'x86_64', release_stage: 'bazinga!' } }
135+
136+
it {
137+
is_expected.to eq 'Dummy Product 99 Bar x86_64'
138+
is_expected.not_to include 'bazinga!'
139+
}
140+
end
141+
131142
describe '.modules_for_migration' do
132143
subject { described_class.modules_for_migration([root_product]) }
133144

spec/serializers/v3/product_serializer_spec.rb

+9
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@
3535
end
3636
end
3737

38+
describe '#friendly_name' do
39+
subject { described_class.new(product).as_json[:friendly_name] }
40+
41+
let(:release_stage) { 'foo' }
42+
let(:product) { create :product, release_stage: release_stage }
43+
44+
it { is_expected.not_to include(release_stage) }
45+
end
46+
3847
describe 'SLES extension tree' do
3948
subject(:serializer) { described_class.new(sles15, root_product: sles15, base_url: base_url) }
4049

0 commit comments

Comments
 (0)