foreman_scc_manager 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96e9a75d883e70453b301cfc95ccdcb3906204f9ae87b5c8abec1f1970bef49f
4
- data.tar.gz: 9b5b2d8a57b2a0da65631603bb77f5b3503353aa0095267ffe7bb4724c93049d
3
+ metadata.gz: bd1877e55ef5915c8b11be58c142ee73292f450a0681cabfe0d4b0d410a977b3
4
+ data.tar.gz: 93678d164b05f4a4fa6a6f5a31ea17f43200acf071a0de58a8266e470b1c90ae
5
5
  SHA512:
6
- metadata.gz: ea1ba3bbdfb6215d48a99ef89a241cf1735de4c085df7e0ee16b849e1bbd786a5734e9b1bfbd79c18ea78d42e2d0440ffbf263e94401b44689a8ef7742b04428
7
- data.tar.gz: 6ef467fe3c5deead9ccc7555a30ac4b96257a8ec269f333d3826b5e28e366def180a5940f1f932be8329719cb488e06d0184ee533c0fb862b915ad135bbf5595
6
+ metadata.gz: d6e11f9a75def00e1752330fcb7288081f1d2730ac6f0ae865b6ddb711ea545ccfd2db98094d9b71ba7d234669b2cb1491fd688dc34d4feca28cd1ad4bb11e5a
7
+ data.tar.gz: 4ff67012a62baf789859ccc57f9b450a49446e185dda4520c4ecac387b8b9755f69ffc30a43a93196d15500efc88b9ffd56627c56f2c4d698f881a6449c4cd41
@@ -1,6 +1,6 @@
1
1
  class SccAccountsController < ApplicationController
2
- before_filter :find_organization
3
- before_filter :find_resource, only: %i[show edit update destroy sync bulk_subscribe]
2
+ before_action :find_organization
3
+ before_action :find_resource, only: %i[show edit update destroy sync bulk_subscribe]
4
4
  include Api::TaxonomyScope
5
5
  include Foreman::Controller::AutoCompleteSearch
6
6
 
@@ -1,5 +1,5 @@
1
1
  class SccProductsController < ApplicationController
2
- before_filter :find_resource, only: %i[show subscribe unsubscribe]
2
+ before_action :find_resource, only: %i[show subscribe unsubscribe]
3
3
  include Api::TaxonomyScope
4
4
  include Foreman::Controller::AutoCompleteSearch
5
5
 
@@ -64,8 +64,13 @@ class SccAccount < ApplicationRecord
64
64
  end
65
65
  # delete repositories beeing removed upstream (Active record seems to be wrong here...)
66
66
  # scc_repositories.where.not(scc_id: upstream_repo_ids).delete_all
67
- upstream_repo_ids_str = upstream_repo_ids.map{ |id| ActiveRecord::Base.sanitize(id) }.join(',')
68
- ActiveRecord::Base.connection.execute("delete from scc_repositories where scc_repositories.scc_account_id = #{ActiveRecord::Base.sanitize(id)} and scc_repositories.scc_id not in (#{upstream_repo_ids_str});")
67
+ if upstream_repo_ids.empty?
68
+ urid_query_fragment = ''
69
+ else
70
+ upstream_repo_ids_str = upstream_repo_ids.map{ |id| ActiveRecord::Base.connection.quote(id) }.join(',')
71
+ urid_query_fragment = " and scc_repositories.scc_id not in (#{upstream_repo_ids_str})"
72
+ end
73
+ ActiveRecord::Base.connection.execute("delete from scc_repositories where scc_repositories.scc_account_id = #{ActiveRecord::Base.connection.quote(id)}#{urid_query_fragment};")
69
74
  end
70
75
 
71
76
  def update_scc_products(upstream_products)
@@ -86,8 +91,13 @@ class SccAccount < ApplicationRecord
86
91
  end
87
92
  # delete products beeing removed upstream (Active record seems to be wrong here...)
88
93
  # scc_products.where.not(scc_id: upstream_product_ids).delete_all
89
- upstream_product_ids_str = upstream_product_ids.map{ |id| ActiveRecord::Base.sanitize(id) }.join(',')
90
- ActiveRecord::Base.connection.execute("delete from scc_products where scc_products.scc_account_id = #{ActiveRecord::Base.sanitize(id)} and scc_products.scc_id not in (#{upstream_product_ids_str});")
94
+ if upstream_product_ids.empty?
95
+ upid_query_fragment = ''
96
+ else
97
+ upstream_product_ids_str = upstream_product_ids.map{ |id| ActiveRecord::Base.connection.quote(id) }.join(',')
98
+ upid_query_fragment = " and scc_products.scc_id not in (#{upstream_product_ids_str})"
99
+ end
100
+ ActiveRecord::Base.connection.execute("delete from scc_products where scc_products.scc_account_id = #{ActiveRecord::Base.connection.quote(id)}#{upid_query_fragment};")
91
101
  # rewire product to product relationships
92
102
  upstream_products.each do |up|
93
103
  extensions = scc_products.where(scc_id: up['extensions'].map { |ext| ext['id'] })
@@ -1,4 +1,4 @@
1
- class CreateSccAccounts < ActiveRecord::Migration
1
+ class CreateSccAccounts < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :scc_accounts do |t|
4
4
  t.string :login, limit: 255
@@ -1,4 +1,4 @@
1
- class CreateSccProducts < ActiveRecord::Migration
1
+ class CreateSccProducts < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :scc_products do |t|
4
4
  t.references :scc_account, index: true, foreign_key: true
@@ -1,4 +1,4 @@
1
- class CreateSccRepositories < ActiveRecord::Migration
1
+ class CreateSccRepositories < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :scc_repositories do |t|
4
4
  t.references :scc_account, index: true, foreign_key: true
@@ -1,4 +1,4 @@
1
- class CreateSccProductsSccRepositoriesJoinTable < ActiveRecord::Migration
1
+ class CreateSccProductsSccRepositoriesJoinTable < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_join_table :scc_products, :scc_repositories do |t|
4
4
  # t.index [:scc_product_id, :scc_repository_id]
@@ -1,4 +1,4 @@
1
- class AddProductTypeToSccProduct < ActiveRecord::Migration
1
+ class AddProductTypeToSccProduct < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :scc_products, :product_type, :string, limit: 63
4
4
  end
@@ -1,4 +1,4 @@
1
- class RemoveRepositoriesFromSccProducts < ActiveRecord::Migration
1
+ class RemoveRepositoriesFromSccProducts < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  remove_column :scc_products, :repositories, :string
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateSccExtendings < ActiveRecord::Migration
1
+ class CreateSccExtendings < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :scc_extendings do |t|
4
4
  t.references :scc_product, index: true, foreign_key: false, null: false
@@ -1,4 +1,4 @@
1
- class AddOrganizationToSccAccount < ActiveRecord::Migration
1
+ class AddOrganizationToSccAccount < ActiveRecord::Migration[4.2]
2
2
  class SccAccount < ApplicationRecord
3
3
  belongs_to :organization
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddProductIdToSccProduct < ActiveRecord::Migration
1
+ class AddProductIdToSccProduct < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :scc_products, :product_id, :integer, index: true, null: true
4
4
  add_foreign_key :scc_products, :katello_products, column: :product_id, on_delete: :nullify
@@ -1,4 +1,4 @@
1
- class AddSyncedToSccAccount < ActiveRecord::Migration
1
+ class AddSyncedToSccAccount < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :scc_accounts, :synced, :datetime, default: nil
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddNameToSccAccount < ActiveRecord::Migration
1
+ class AddNameToSccAccount < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :scc_accounts, :name, :string, limit: 255
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddSyncStatusToSccAccount < ActiveRecord::Migration
1
+ class AddSyncStatusToSccAccount < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :scc_accounts, :sync_status, :string
4
4
  end
@@ -1,4 +1,4 @@
1
- class ChangeSyncStatusToSyncTask < ActiveRecord::Migration
1
+ class ChangeSyncStatusToSyncTask < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  remove_column :scc_accounts, :sync_status, :string
4
4
  add_column :scc_accounts, :sync_task_id, :uuid, null: true
@@ -1,3 +1,3 @@
1
1
  module ForemanSccManager
2
- VERSION = '1.3.0'.freeze
2
+ VERSION = '1.3.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_scc_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ATIX AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-15 00:00:00.000000000 Z
11
+ date: 2018-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: rubocop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4'
19
+ version: '0.49'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4'
26
+ version: '0.49'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rubocop
28
+ name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.49'
33
+ version: '4'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.49'
40
+ version: '4'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rdoc
42
+ name: rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4'
48
- type: :development
47
+ version: '5.1'
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '4'
54
+ version: '5.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: foreman-tasks
57
57
  requirement: !ruby/object:Gem::Requirement