foreman_scc_manager 5.0.1 → 5.0.3
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/app/controllers/api/v2/scc_accounts_controller.rb +2 -0
- data/app/controllers/api/v2/scc_products_controller.rb +5 -2
- data/app/controllers/scc_accounts_controller.rb +1 -27
- data/lib/foreman_scc_manager/version.rb +1 -1
- data/test/controllers/scc_accounts_controller_test.rb +0 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f0843880bcdc6190c26125ed2d847bae7f1c59dadad31e8db6cd5d0464029e0
|
4
|
+
data.tar.gz: 6ae97fbe01ae019d75d276b991e7d886dfa281f6ff2918c422b6f4217add18f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd11bc35bb22c25f1361481656f6731173fc13d6b4045ef68f8105541eb0e30dbc81579424284f2c4c3c3dc1a04c8d235568712e607166d7b0b17d2b6e7ac0a3
|
7
|
+
data.tar.gz: 9e29bc421463c59360b5e6bfa31761a06e6d537aeaaf6f7c95e14c882116bf6afbdf5ed8af783e383d93fce65ab3afc6479aab3387c83a393114abe03e4c2d4e
|
@@ -8,6 +8,8 @@ module Api
|
|
8
8
|
resource_id 'scc_accounts'
|
9
9
|
api_version 'v2'
|
10
10
|
api_base_url '/api/v2'
|
11
|
+
param :location_id, Integer, :show => false
|
12
|
+
param :organization_id, Integer, :show => false
|
11
13
|
end
|
12
14
|
|
13
15
|
before_action :find_resource, :only => [:show, :update, :destroy, :sync, :bulk_subscribe, :bulk_subscribe_with_repos]
|
@@ -8,6 +8,8 @@ module Api
|
|
8
8
|
resource_id 'scc_products'
|
9
9
|
api_version 'v2'
|
10
10
|
api_base_url '/api/v2'
|
11
|
+
param :location_id, Integer, :show => false
|
12
|
+
param :organization_id, Integer, :show => false
|
11
13
|
end
|
12
14
|
|
13
15
|
before_action :find_resource, :only => [:show, :subscribe]
|
@@ -24,11 +26,12 @@ module Api
|
|
24
26
|
param :scc_account_id, :identifier_dottable, :required => true
|
25
27
|
param :subscribed_only, :bool, :required => false, :desc => N_('Show subscribed products only')
|
26
28
|
param_group :search_and_pagination, ::Api::V2::BaseController
|
29
|
+
add_scoped_search_description_for(SccProduct)
|
27
30
|
|
28
31
|
def index
|
29
|
-
scope =
|
32
|
+
scope = resource_scope_for_index
|
30
33
|
scope = scope.where.not(:product_id => nil) if ::Foreman::Cast.to_bool(params[:subscribed_only])
|
31
|
-
@scc_products = scope
|
34
|
+
@scc_products = scope
|
32
35
|
end
|
33
36
|
|
34
37
|
api :GET, '/scc_accounts/:scc_account_id/scc_products/:id/', N_('Show an scc_account product')
|
@@ -2,7 +2,7 @@ class SccAccountsController < ApplicationController
|
|
2
2
|
helper_method :scc_filtered_products
|
3
3
|
helper_method :create_nested_product_tree
|
4
4
|
before_action :find_organization
|
5
|
-
before_action :find_resource, only: %i[show edit update destroy sync
|
5
|
+
before_action :find_resource, only: %i[show edit update destroy sync]
|
6
6
|
before_action :find_available_gpg_keys, only: %i[new edit update create]
|
7
7
|
include Foreman::Controller::AutoCompleteSearch
|
8
8
|
|
@@ -79,26 +79,6 @@ class SccAccountsController < ApplicationController
|
|
79
79
|
redirect_to scc_accounts_path
|
80
80
|
end
|
81
81
|
|
82
|
-
def bulk_subscribe
|
83
|
-
scc_products_to_subscribe =
|
84
|
-
@scc_account.scc_products.where(id: scc_bulk_subscribe_params[:scc_subscribe_product_ids])
|
85
|
-
|
86
|
-
if scc_products_to_subscribe.count > 0
|
87
|
-
ForemanTasks.async_task(::Actions::BulkAction,
|
88
|
-
::Actions::SccManager::SubscribeProduct,
|
89
|
-
scc_products_to_subscribe)
|
90
|
-
success _('Task to subscribe products started.')
|
91
|
-
else
|
92
|
-
warning _('No products selected.')
|
93
|
-
end
|
94
|
-
rescue ::Foreman::Exception => e
|
95
|
-
error _('Failed to add task to queue: %s') % e.to_s
|
96
|
-
rescue ForemanTasks::Lock::LockConflict => e
|
97
|
-
error _('Lock on SCC account already taken: %s') % e.to_s
|
98
|
-
ensure
|
99
|
-
redirect_to scc_accounts_path
|
100
|
-
end
|
101
|
-
|
102
82
|
def create_nested_product_tree(scc_products, subscribed_only:)
|
103
83
|
if subscribed_only
|
104
84
|
scc_products_base = scc_products.where(:product_type => 'base').where.not(:product_id => nil).includes([:scc_extensions])
|
@@ -184,16 +164,10 @@ class SccAccountsController < ApplicationController
|
|
184
164
|
)
|
185
165
|
end
|
186
166
|
|
187
|
-
def scc_bulk_subscribe_params
|
188
|
-
params.require(:scc_account).permit(:scc_subscribe_product_ids => [])
|
189
|
-
end
|
190
|
-
|
191
167
|
def action_permission
|
192
168
|
case params[:action]
|
193
169
|
when 'sync', 'test_connection'
|
194
170
|
:sync
|
195
|
-
when 'bulk_subscribe'
|
196
|
-
:use
|
197
171
|
else
|
198
172
|
super
|
199
173
|
end
|
@@ -139,18 +139,6 @@ class SccAccountsControllerTest < ActionController::TestCase
|
|
139
139
|
assert_redirected_to '/scc_accounts'
|
140
140
|
end
|
141
141
|
|
142
|
-
test 'SCC server bulk subscribe products' do
|
143
|
-
stub_custom_request('https://scc.example.com/connect/organizations/repositories')
|
144
|
-
|
145
|
-
account = scc_accounts(:one)
|
146
|
-
product1 = scc_products(:one)
|
147
|
-
product2 = scc_products(:two)
|
148
|
-
account.scc_products = [product1, product2]
|
149
|
-
put :bulk_subscribe, params: { :id => account.id, :scc_account => { :scc_subscribe_product_ids => [product1.id, product2.id] } }, session: set_session_user
|
150
|
-
|
151
|
-
assert_redirected_to '/scc_accounts'
|
152
|
-
end
|
153
|
-
|
154
142
|
test 'should delete scc_account' do
|
155
143
|
account = scc_accounts(:two)
|
156
144
|
assert_difference 'SccAccount.count', -1 do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_scc_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ATIX AG
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-08-
|
10
|
+
date: 2025-08-27 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rdoc
|