foreman_scc_manager 1.8.10 → 1.8.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +18 -10
- data/Rakefile +5 -9
- data/app/controllers/api/v2/scc_products_controller.rb +14 -3
- data/app/controllers/scc_accounts_controller.rb +7 -3
- data/app/lib/actions/scc_manager/subscribe_product.rb +5 -1
- data/app/lib/scc_manager.rb +5 -9
- data/app/models/scc_account.rb +6 -6
- data/app/models/scc_repository.rb +2 -2
- data/config/routes.rb +1 -1
- data/db/migrate/20201119084201_add_gpg_key_to_scc_account.rb +6 -2
- data/db/migrate/20210713092440_add_permissions.rb +8 -8
- data/lib/foreman_scc_manager/engine.rb +22 -4
- data/lib/foreman_scc_manager/version.rb +1 -1
- data/test/actions/sync_test.rb +24 -0
- data/test/controllers/api/v2/scc_products_test.rb +21 -1
- data/test/fixtures/models/scc_products.yml +18 -3
- data/test/models/scc_product_test.rb +1 -1
- data/test/test_plugin_helper.rb +2 -0
- metadata +16 -20
- data/locale/de/foreman_scc_manager.edit.po +0 -574
- data/locale/de/foreman_scc_manager.po.time_stamp +0 -0
- data/locale/en/foreman_scc_manager.edit.po +0 -566
- data/locale/en/foreman_scc_manager.po.time_stamp +0 -0
- data/test/controllers/scc_accounts_controller_test2.rb +0 -51
- data/test/fixtures/models/scc_extendings.yml +0 -6
- data/test/test_controller_helper.rb +0 -15
- data/test/unit/access_permissions_test.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd540b3e5ecde9d0174c474698db985365681fc85eede30117eb2663f51f2158
|
4
|
+
data.tar.gz: 9a44579a7948089c9a708dee17f6ac7d7805c68d995feeaf6f5a3e46babda35b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b6c6e4a370f1e8a2d133a6891ba5b4493ecab019e4d32df920be9cfacc220ff86bcf69080c57c073d07015d916065260999ff9cc2e01ea2542947bfad400dcf
|
7
|
+
data.tar.gz: 5f6afa5a1e2899643779855270b38a31df1d6a4bc2ba49ddc3643529add32ad8b4129a642aa570f4498a847ccdc90c21b0ad7c22497e8e6328dc5037de5724a7
|
data/README.md
CHANGED
@@ -1,13 +1,20 @@
|
|
1
|
-
|
1
|
+

|
2
|
+

|
3
|
+
[](https://badge.fury.io/rb/foreman_scc_manager)
|
2
4
|
|
3
|
-
#
|
5
|
+
# Foreman SCC Manager
|
4
6
|
|
5
|
-
Foreman plugin to sync SUSE Customer Center products and repositories into Katello
|
7
|
+
Foreman plugin to sync SUSE Customer Center products and repositories into Katello.
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
+
This plugin installation is not supported by foreman-installer and has to be installed manually:
|
12
|
+
|
13
|
+
```sh
|
14
|
+
yum install tfm-rubygem-foreman_scc_manager
|
15
|
+
|
16
|
+
foreman-installer
|
17
|
+
```
|
11
18
|
|
12
19
|
## Compatibility
|
13
20
|
|
@@ -27,10 +34,12 @@ for how to install Foreman plugins
|
|
27
34
|
| 1.15 | 3.4 | ~> 1.1.0 |
|
28
35
|
|
29
36
|
## Documentation
|
30
|
-
The plugin documentation can be found at https://docs.orcharhino.com/sources/management_ui/the_content_menu/suse_subscriptions.html.
|
31
37
|
|
32
|
-
|
33
|
-
|
38
|
+
[Plugin documentation](https://docs.orcharhino.com/or/docs/sources/usage_guides/managing_sles_systems_guide.html#mssg_installing_the_scc_manager_plugin)
|
39
|
+
|
40
|
+
## Hammer CLI Extension
|
41
|
+
|
42
|
+
[Hammer CLI for Foreman SCC Manager](https://github.com/ATIX-AG/hammer-cli-foreman-scc-manager)
|
34
43
|
|
35
44
|
## Contributing
|
36
45
|
|
@@ -38,7 +47,7 @@ Fork and send a Pull Request. Thanks!
|
|
38
47
|
|
39
48
|
## Copyright
|
40
49
|
|
41
|
-
Copyright (c) 2021 ATIX AG -
|
50
|
+
Copyright (c) 2021 ATIX AG - https://atix.de
|
42
51
|
|
43
52
|
This program is free software: you can redistribute it and/or modify
|
44
53
|
it under the terms of the GNU General Public License as published by
|
@@ -52,4 +61,3 @@ GNU General Public License for more details.
|
|
52
61
|
|
53
62
|
You should have received a copy of the GNU General Public License
|
54
63
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
55
|
-
|
data/Rakefile
CHANGED
@@ -35,13 +35,9 @@ end
|
|
35
35
|
|
36
36
|
task default: :test
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
puts 'Rubocop not loaded.'
|
43
|
-
end
|
44
|
-
|
45
|
-
task :default do
|
46
|
-
Rake::Task['rubocop'].execute
|
38
|
+
class ForemanSccManager::Engine
|
39
|
+
def self.root
|
40
|
+
File.expand_path('__dir__')
|
41
|
+
end
|
47
42
|
end
|
43
|
+
import 'lib/tasks/rubocop.rake'
|
@@ -12,11 +12,22 @@ module Api
|
|
12
12
|
|
13
13
|
before_action :find_resource, :only => [:show, :subscribe]
|
14
14
|
|
15
|
-
|
15
|
+
def metadata_subtotal
|
16
|
+
if @scc_products.present?
|
17
|
+
@scc_products.count
|
18
|
+
else
|
19
|
+
super
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
api :GET, '/scc_accounts/:scc_account_id/scc_products/', N_('List products for an scc_account')
|
16
24
|
param :scc_account_id, :identifier_dottable, :required => true
|
25
|
+
param :subscribed_only, :bool, :required => false, :desc => N_('Show subscribed products only')
|
17
26
|
param_group :search_and_pagination, ::Api::V2::BaseController
|
27
|
+
|
18
28
|
def index
|
19
29
|
scope = resource_scope
|
30
|
+
scope = scope.where.not(:product_id => nil) if ::Foreman::Cast.to_bool(params[:subscribed_only])
|
20
31
|
scope = scope.where(:organization => params[:organization_id]) if params[:organization_id].present?
|
21
32
|
@scc_products = scope.search_for(params[:search], :order => params[:order]).paginate(:page => params[:page])
|
22
33
|
end
|
@@ -47,8 +58,8 @@ module Api
|
|
47
58
|
private
|
48
59
|
|
49
60
|
def find_resource
|
50
|
-
@scc_account = ::SccAccount.
|
51
|
-
@scc_product = @scc_account.scc_products.
|
61
|
+
@scc_account = ::SccAccount.find(params[:scc_account_id])
|
62
|
+
@scc_product = @scc_account.scc_products.find(params[:id])
|
52
63
|
end
|
53
64
|
|
54
65
|
def action_permission
|
@@ -37,7 +37,7 @@ class SccAccountsController < ApplicationController
|
|
37
37
|
# POST /scc_accounts/test_connection
|
38
38
|
def test_connection
|
39
39
|
@scc_account = SccAccount.new(scc_account_params)
|
40
|
-
@scc_account.password = SccAccount.
|
40
|
+
@scc_account.password = SccAccount.find(params[:scc_account_id]).password if params[:scc_account_id].present? && scc_account_params[:password].empty?
|
41
41
|
respond_to do |format|
|
42
42
|
if @scc_account.test_connection
|
43
43
|
format.json { render json: nil, status: :ok }
|
@@ -101,12 +101,16 @@ class SccAccountsController < ApplicationController
|
|
101
101
|
|
102
102
|
def find_available_gpg_keys
|
103
103
|
@scc_account ? org = @scc_account.organization : org = @organization
|
104
|
-
|
104
|
+
if ::Katello.const_defined?(:ContentCredential)
|
105
|
+
@selectable_gpg_keys = ::Katello::ContentCredential.where(organization: org).collect { |p| [p.name, p.id] }.unshift ['None', nil]
|
106
|
+
else
|
107
|
+
@selectable_gpg_keys = ::Katello::GpgKey.where(organization: org).collect { |p| [p.name, p.id] }.unshift ['None', nil]
|
108
|
+
end
|
105
109
|
end
|
106
110
|
|
107
111
|
def find_organization
|
108
112
|
@organization = Organization.current
|
109
|
-
redirect_to
|
113
|
+
redirect_to "/select_organization?toState=#{request.path}" unless @organization
|
110
114
|
end
|
111
115
|
|
112
116
|
# Use callbacks to share common setup or constraints between actions.
|
@@ -54,7 +54,11 @@ module Actions
|
|
54
54
|
def create_sub_plans
|
55
55
|
product = ::Katello::Product.new
|
56
56
|
product.name = input[:product_name]
|
57
|
-
|
57
|
+
if ::Katello.const_defined?(:ContentCredential)
|
58
|
+
product.gpg_key = ::Katello::ContentCredential.find_by(id: input[:gpg_key], organization: input[:organization_id])
|
59
|
+
else
|
60
|
+
product.gpg_key = ::Katello::GpgKey.find_by(id: input[:gpg_key], organization: input[:organization_id])
|
61
|
+
end
|
58
62
|
product.description = input[:product_description]
|
59
63
|
trigger(::Actions::Katello::Product::Create,
|
60
64
|
product,
|
data/app/lib/scc_manager.rb
CHANGED
@@ -1,21 +1,17 @@
|
|
1
1
|
module SccManager
|
2
2
|
# adapted from https://github.com/SUSE/connect
|
3
3
|
def self.get_scc_data(base_url, rest_url, login, password)
|
4
|
-
if
|
5
|
-
|
6
|
-
uri =
|
7
|
-
|
8
|
-
uri.scheme = URI.parse(proxy_config[:host]).scheme
|
9
|
-
uri.host = URI.parse(proxy_config[:host]).host
|
10
|
-
uri.port = proxy_config[:port].try(:to_s)
|
11
|
-
uri.user = proxy_config[:user]
|
4
|
+
if (proxy_config = ::HttpProxy.default_global_content_proxy)
|
5
|
+
uri = URI(proxy_config[:url])
|
6
|
+
uri.user = proxy_config[:username]
|
12
7
|
uri.password = proxy_config[:password] if uri.user.present?
|
13
8
|
|
14
9
|
RestClient.proxy = uri.to_s
|
15
10
|
end
|
16
11
|
|
17
12
|
url = base_url + rest_url
|
18
|
-
|
13
|
+
credentials = Base64.encode64("#{login}:#{password}").chomp
|
14
|
+
auth_header = { Authorization: "Basic #{credentials}",
|
19
15
|
Accept: 'application/vnd.scc.suse.com.v4+json' }
|
20
16
|
results = []
|
21
17
|
loop do
|
data/app/models/scc_account.rb
CHANGED
@@ -172,7 +172,7 @@ class SccAccount < ApplicationRecord
|
|
172
172
|
def update_scc_repositories(upstream_repositories)
|
173
173
|
upstream_repo_ids = []
|
174
174
|
# initially invalidate all repositories and validate them during update
|
175
|
-
invalidated_repos = invalidate_subscription_status(scc_repositories)
|
175
|
+
invalidated_repos = invalidate_subscription_status(scc_repositories, save_record: false)
|
176
176
|
# import repositories
|
177
177
|
upstream_repositories.each do |ur|
|
178
178
|
cached_repository = scc_repositories.find_or_initialize_by(scc_id: ur['id'])
|
@@ -196,7 +196,7 @@ class SccAccount < ApplicationRecord
|
|
196
196
|
# subscription_valid can be set to nil
|
197
197
|
to_invalidate = invalidated_repos.select { |ir| ir.katello_root_repository_id.present? && !ir.subscription_valid }
|
198
198
|
::Foreman::Logging.logger('foreman_scc_manager').debug "Invalidating #{to_invalidate.count} expired repositories"
|
199
|
-
invalidate_subscription_status(to_invalidate, true)
|
199
|
+
invalidate_subscription_status(to_invalidate, save_record: true)
|
200
200
|
|
201
201
|
# delete repositories being removed upstream and that are not subscribed to
|
202
202
|
to_delete = scc_repositories.where.not(scc_id: upstream_repo_ids)
|
@@ -207,7 +207,7 @@ class SccAccount < ApplicationRecord
|
|
207
207
|
def update_scc_products(upstream_products)
|
208
208
|
upstream_product_ids = []
|
209
209
|
# initially invalidate all products and validate them during update
|
210
|
-
invalidated_products = invalidate_subscription_status(scc_products)
|
210
|
+
invalidated_products = invalidate_subscription_status(scc_products, save_record: false)
|
211
211
|
# import products
|
212
212
|
upstream_products.each do |up|
|
213
213
|
cached_product = scc_products.find_or_initialize_by(scc_id: up['id'])
|
@@ -233,7 +233,7 @@ class SccAccount < ApplicationRecord
|
|
233
233
|
# subscription_valid can be set to nil
|
234
234
|
to_invalidate = invalidated_products.select { |ip| ip.product_id.present? && !ip.subscription_valid }
|
235
235
|
::Foreman::Logging.logger('foreman_scc_manager').debug "Invalidating #{to_invalidate.count} expired products"
|
236
|
-
invalidate_subscription_status(to_invalidate, true)
|
236
|
+
invalidate_subscription_status(to_invalidate, save_record: true)
|
237
237
|
|
238
238
|
# delete products being removed upstream and that are not subscribed to
|
239
239
|
to_delete = scc_products.where.not(scc_id: upstream_product_ids).where(product_id: nil)
|
@@ -266,9 +266,9 @@ class SccAccount < ApplicationRecord
|
|
266
266
|
|
267
267
|
# set all products/repos invalid
|
268
268
|
# params: items_to_invalidate: ActiveRecord_(*)
|
269
|
-
# save_record: store in database or not
|
269
|
+
# save_record: store in database or not
|
270
270
|
# return: ActiveRecord elements with invalidated subscription status
|
271
|
-
def invalidate_subscription_status(items_to_invalidate, save_record
|
271
|
+
def invalidate_subscription_status(items_to_invalidate, save_record:)
|
272
272
|
if items_to_invalidate.present?
|
273
273
|
items_to_invalidate.each do |inv|
|
274
274
|
inv.subscription_valid = false
|
@@ -9,11 +9,11 @@ class SccRepository < ApplicationRecord
|
|
9
9
|
has_and_belongs_to_many :scc_products
|
10
10
|
|
11
11
|
def full_url
|
12
|
-
token.blank? ? url : url
|
12
|
+
token.blank? ? url : "#{url}?#{token}"
|
13
13
|
end
|
14
14
|
|
15
15
|
def uniq_name(scc_product)
|
16
|
-
scc_product.scc_id
|
16
|
+
"#{scc_product.scc_id} #{description}"
|
17
17
|
end
|
18
18
|
|
19
19
|
def pretty_name
|
data/config/routes.rb
CHANGED
@@ -23,7 +23,7 @@ Rails.application.routes.draw do
|
|
23
23
|
:defaults => { :apiv => 'v2' },
|
24
24
|
:apiv => /v1|v2/,
|
25
25
|
:constraints => ApiConstraints.new(:version => 2, :default => true) do
|
26
|
-
resources :scc_accounts do
|
26
|
+
resources :scc_accounts, except: %i[new edit] do
|
27
27
|
collection do
|
28
28
|
post 'test_connection'
|
29
29
|
get 'auto_complete_search'
|
@@ -1,6 +1,10 @@
|
|
1
1
|
class AddGpgKeyToSccAccount < ActiveRecord::Migration[5.2]
|
2
2
|
def change
|
3
|
-
add_column :scc_accounts, :katello_gpg_key_id, :integer,
|
4
|
-
|
3
|
+
add_column :scc_accounts, :katello_gpg_key_id, :integer, null: true
|
4
|
+
if ActiveRecord::Base.connection.table_exists? :katello_content_credentials
|
5
|
+
add_foreign_key :scc_accounts, :katello_content_credentials, column: :katello_gpg_key_id, on_delete: :nullify
|
6
|
+
else
|
7
|
+
add_foreign_key :scc_accounts, :katello_gpg_keys, column: :katello_gpg_key_id, on_delete: :nullify
|
8
|
+
end
|
5
9
|
end
|
6
10
|
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
class AddPermissions < ActiveRecord::Migration[6.0]
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
{ 'name' => 'test_connection_scc_accounts', 'resource_type' => 'SccAccount' }
|
2
|
+
PRODUCT_PERMISSION_NAMES = [
|
3
|
+
'view_scc_products',
|
4
|
+
'subscribe_scc_products'
|
6
5
|
].freeze
|
7
6
|
|
8
7
|
def up
|
9
|
-
|
10
|
-
|
8
|
+
Permission.create!(:name => 'test_connection_scc_accounts', :resource_type => 'SccAccount')
|
9
|
+
PRODUCT_PERMISSION_NAMES.each do |p|
|
10
|
+
Permission.create!(:name => p, :resource_type => SccProduct)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
def down
|
15
|
-
|
16
|
-
Permission.where(:name => p
|
15
|
+
(PRODUCT_PERMISSION_NAMES + ['test_connection_scc_accounts']).each do |p|
|
16
|
+
Permission.where(:name => p).destroy_all
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -32,8 +32,8 @@ module ForemanSccManager
|
|
32
32
|
# Add permissions
|
33
33
|
security_block :foreman_scc_manager do
|
34
34
|
permission :view_scc_accounts,
|
35
|
-
{ :scc_accounts => [:show, :index],
|
36
|
-
:'api/v2/scc_accounts' => [:show, :index] },
|
35
|
+
{ :scc_accounts => [:show, :index, :auto_complete_search],
|
36
|
+
:'api/v2/scc_accounts' => [:show, :index, :auto_complete_search] },
|
37
37
|
:resource_type => 'SccAccount'
|
38
38
|
|
39
39
|
permission :use_scc_accounts,
|
@@ -60,15 +60,33 @@ module ForemanSccManager
|
|
60
60
|
{ :scc_accounts => [:sync],
|
61
61
|
:'api/v2/scc_accounts' => [:sync] },
|
62
62
|
:resource_type => 'SccAccount'
|
63
|
+
|
64
|
+
permission :test_connection_scc_accounts,
|
65
|
+
{ :scc_accounts => [:test_connection],
|
66
|
+
:'api/v2/scc_accounts' => [:test_connection] },
|
67
|
+
:resource_type => 'SccAccount'
|
68
|
+
|
69
|
+
permission :view_scc_products,
|
70
|
+
{ :scc_products => [:index, :show],
|
71
|
+
:'api/v2/scc_products' => [:index, :show] },
|
72
|
+
:resource_type => 'SccProduct'
|
73
|
+
|
74
|
+
permission :subscribe_scc_products,
|
75
|
+
{ :scc_products => [:subscribe, :unsubscribe],
|
76
|
+
:'api/v2/scc_products' => [:subscribe, :unsibscribe] },
|
77
|
+
:resource_type => 'SccProduct'
|
63
78
|
end
|
64
79
|
|
65
80
|
# Add a new role called 'SccManager' if it doesn't exist
|
66
81
|
role 'SccManager',
|
67
|
-
%i[view_scc_accounts use_scc_accounts new_scc_accounts edit_scc_accounts
|
82
|
+
%i[view_scc_accounts use_scc_accounts new_scc_accounts edit_scc_accounts
|
83
|
+
delete_scc_accounts sync_scc_accounts test_connection_scc_accounts
|
84
|
+
view_scc_products subscribe_scc_products],
|
68
85
|
'Role granting permissons to manage SUSE Subscriptions'
|
69
86
|
|
70
87
|
role 'SccViewer',
|
71
|
-
%i[view_scc_accounts use_scc_accounts sync_scc_accounts
|
88
|
+
%i[view_scc_accounts use_scc_accounts sync_scc_accounts
|
89
|
+
create_products view_products subscribe_scc_products view_scc_products],
|
72
90
|
'Role granting permissons to view and use SUSE Subscriptions'
|
73
91
|
|
74
92
|
add_all_permissions_to_default_roles
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
class SccManagerActions < ActiveSupport::TestCase
|
4
|
+
include Dynflow::Testing
|
5
|
+
|
6
|
+
let(:action_class) { ::Actions::SccManager::Sync }
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@scc_account = scc_accounts(:one)
|
10
|
+
# ensure we have an org label
|
11
|
+
get_organization
|
12
|
+
end
|
13
|
+
|
14
|
+
test 'plan sync action' do
|
15
|
+
action = create_action(action_class)
|
16
|
+
action.stubs(:action_subject).with(@scc_account)
|
17
|
+
|
18
|
+
assert_respond_to(action, :phase)
|
19
|
+
plan_action(action, @scc_account)
|
20
|
+
|
21
|
+
assert_action_planned_with(action, ::Actions::SccManager::SyncProducts, @scc_account)
|
22
|
+
assert_action_planned_with(action, ::Actions::SccManager::SyncRepositories, @scc_account)
|
23
|
+
end
|
24
|
+
end
|
@@ -5,7 +5,9 @@ class Api::V2::SccProductsControllerTest < ActionController::TestCase
|
|
5
5
|
@scc_account = scc_accounts(:one)
|
6
6
|
@scc_product1 = scc_products(:one)
|
7
7
|
@scc_product2 = scc_products(:two)
|
8
|
-
@
|
8
|
+
@scc_product3 = scc_products(:three)
|
9
|
+
@scc_product4 = scc_products(:four)
|
10
|
+
@scc_account.scc_products = [@scc_product1, @scc_product2, @scc_product3, @scc_product4]
|
9
11
|
end
|
10
12
|
|
11
13
|
test 'should get index' do
|
@@ -37,4 +39,22 @@ class Api::V2::SccProductsControllerTest < ActionController::TestCase
|
|
37
39
|
put :subscribe, params: { :id => 'doest-not-exit', :scc_account_id => @scc_account.id }
|
38
40
|
assert_response :not_found
|
39
41
|
end
|
42
|
+
|
43
|
+
test 'show subscribed products only' do
|
44
|
+
get :index, params: { :scc_account_id => @scc_account.id, :subscribed_only => true }
|
45
|
+
assert_response :success
|
46
|
+
body = ActiveSupport::JSON.decode(@response.body)
|
47
|
+
assert_not_empty body
|
48
|
+
assert_equal 2, body['results'].count
|
49
|
+
assert_equal 2, body['subtotal']
|
50
|
+
end
|
51
|
+
|
52
|
+
test 'show all products if subscribed_only flag is set to false' do
|
53
|
+
get :index, params: { :scc_account_id => @scc_account.id, :subscribed_only => false }
|
54
|
+
assert_response :success
|
55
|
+
body = ActiveSupport::JSON.decode(@response.body)
|
56
|
+
assert_not_empty body
|
57
|
+
assert_equal 4, body['results'].count
|
58
|
+
assert_equal 4, body['subtotal']
|
59
|
+
end
|
40
60
|
end
|
@@ -10,6 +10,7 @@ one:
|
|
10
10
|
description: "<p> lorem ipsum dolor sit amet </p>"
|
11
11
|
product_type: base
|
12
12
|
subscription_valid: nil
|
13
|
+
product_id: nil
|
13
14
|
|
14
15
|
two:
|
15
16
|
scc_account_id: test_account1
|
@@ -21,6 +22,7 @@ two:
|
|
21
22
|
description: "<p> lorem ipsum dolor sit amet </p><p> lorem lorem lorem </p>"
|
22
23
|
product_type: extras
|
23
24
|
subscription_valid: true
|
25
|
+
product_id: nil
|
24
26
|
|
25
27
|
three:
|
26
28
|
scc_account_id: test_account1
|
@@ -32,18 +34,31 @@ three:
|
|
32
34
|
description: lorem ipsum dolor sit amet
|
33
35
|
product_type: base
|
34
36
|
subscription_valid: nil
|
37
|
+
product_id: 1
|
38
|
+
|
39
|
+
four:
|
40
|
+
scc_account_id: test_account1
|
41
|
+
scc_id: 444
|
42
|
+
name: four
|
43
|
+
version: 4
|
44
|
+
arch: x86_128
|
45
|
+
friendly_name: number four
|
46
|
+
description: lorem ipsum dolor sit amet
|
47
|
+
product_type: base
|
48
|
+
subscription_valid: nil
|
49
|
+
product_id: 2
|
35
50
|
|
36
51
|
# create a couple of products as scc_extensions
|
37
52
|
<% 1.upto(10) do |i| %>
|
38
53
|
p_extension_<%= i %>:
|
39
54
|
scc_account_id: test_account1
|
40
55
|
scc_id: <%= i %>
|
41
|
-
name: p_ext_<%= i%>
|
56
|
+
name: p_ext_<%= i%>
|
42
57
|
version: 3
|
43
58
|
arch: x86_128
|
44
|
-
friendly_name: number <%= i%>
|
59
|
+
friendly_name: number <%= i%>
|
45
60
|
description: lorem ipsum dolor sit amet
|
46
61
|
product_type: extension
|
47
62
|
subscription_valid: nil
|
63
|
+
product_id: nil
|
48
64
|
<% end %>
|
49
|
-
|
@@ -30,7 +30,7 @@ end
|
|
30
30
|
|
31
31
|
class SccProductSearchTest < ActiveSupport::TestCase
|
32
32
|
test 'default ordered by name' do
|
33
|
-
product_names = ['one', 'two', 'three',
|
33
|
+
product_names = ['one', 'two', 'three', 'four',
|
34
34
|
'p_ext_1', 'p_ext_10', 'p_ext_2', 'p_ext_3',
|
35
35
|
'p_ext_4', 'p_ext_5', 'p_ext_6', 'p_ext_7',
|
36
36
|
'p_ext_8', 'p_ext_9']
|
data/test/test_plugin_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_scc_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ATIX AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -16,42 +16,48 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 6.3.1
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
29
|
+
version: '6'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 6.3.1
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rubocop
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
39
|
+
version: 0.89.0
|
34
40
|
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
46
|
+
version: 0.89.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rubocop-rails
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
53
|
+
version: 2.8.1
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
60
|
+
version: 2.8.1
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: webmock
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,19 +173,15 @@ files:
|
|
167
173
|
- locale/Makefile
|
168
174
|
- locale/action_names.rb
|
169
175
|
- locale/de/LC_MESSAGES/foreman_scc_manager.mo
|
170
|
-
- locale/de/foreman_scc_manager.edit.po
|
171
176
|
- locale/de/foreman_scc_manager.po
|
172
|
-
- locale/de/foreman_scc_manager.po.time_stamp
|
173
177
|
- locale/en/LC_MESSAGES/foreman_scc_manager.mo
|
174
|
-
- locale/en/foreman_scc_manager.edit.po
|
175
178
|
- locale/en/foreman_scc_manager.po
|
176
|
-
- locale/en/foreman_scc_manager.po.time_stamp
|
177
179
|
- locale/foreman_scc_manager.pot
|
178
180
|
- locale/gemspec.rb
|
181
|
+
- test/actions/sync_test.rb
|
179
182
|
- test/controllers/api/v2/scc_accounts_test.rb
|
180
183
|
- test/controllers/api/v2/scc_products_test.rb
|
181
184
|
- test/controllers/scc_accounts_controller_test.rb
|
182
|
-
- test/controllers/scc_accounts_controller_test2.rb
|
183
185
|
- test/factories/foreman_scc_manager_factories.rb
|
184
186
|
- test/features/sync_test.rb
|
185
187
|
- test/fixtures/files/data_products_page1.json
|
@@ -187,15 +189,12 @@ files:
|
|
187
189
|
- test/fixtures/files/data_repositories.json
|
188
190
|
- test/fixtures/files/data_subscriptions.json
|
189
191
|
- test/fixtures/models/scc_accounts.yml
|
190
|
-
- test/fixtures/models/scc_extendings.yml
|
191
192
|
- test/fixtures/models/scc_products.yml
|
192
193
|
- test/fixtures/models/scc_repositories.yml
|
193
194
|
- test/models/scc_account_test.rb
|
194
195
|
- test/models/scc_product_test.rb
|
195
196
|
- test/support/fixtures_support.rb
|
196
|
-
- test/test_controller_helper.rb
|
197
197
|
- test/test_plugin_helper.rb
|
198
|
-
- test/unit/access_permissions_test.rb
|
199
198
|
- test/unit/foreman_scc_manager_test.rb
|
200
199
|
homepage: https://www.orcharhino.com/
|
201
200
|
licenses:
|
@@ -221,22 +220,19 @@ signing_key:
|
|
221
220
|
specification_version: 4
|
222
221
|
summary: Suse Customer Center plugin for Foreman
|
223
222
|
test_files:
|
224
|
-
- test/unit/access_permissions_test.rb
|
225
223
|
- test/unit/foreman_scc_manager_test.rb
|
226
|
-
- test/test_controller_helper.rb
|
227
224
|
- test/features/sync_test.rb
|
228
225
|
- test/models/scc_product_test.rb
|
229
226
|
- test/models/scc_account_test.rb
|
230
227
|
- test/factories/foreman_scc_manager_factories.rb
|
231
228
|
- test/controllers/api/v2/scc_accounts_test.rb
|
232
229
|
- test/controllers/api/v2/scc_products_test.rb
|
233
|
-
- test/controllers/scc_accounts_controller_test2.rb
|
234
230
|
- test/controllers/scc_accounts_controller_test.rb
|
231
|
+
- test/actions/sync_test.rb
|
235
232
|
- test/support/fixtures_support.rb
|
236
233
|
- test/fixtures/models/scc_accounts.yml
|
237
234
|
- test/fixtures/models/scc_repositories.yml
|
238
235
|
- test/fixtures/models/scc_products.yml
|
239
|
-
- test/fixtures/models/scc_extendings.yml
|
240
236
|
- test/fixtures/files/data_products_page2.json
|
241
237
|
- test/fixtures/files/data_products_page1.json
|
242
238
|
- test/fixtures/files/data_subscriptions.json
|