foreman_scc_manager 1.6.0 → 1.6.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: 1a29f70bc667b2d96113d1852e32f0eb58acabb875ec0c8285008e058ee67d43
4
- data.tar.gz: 80db612f6a5aef4dcd1bdaf707f8a8cb6f5c60abf68066b2254a80d323c7a189
3
+ metadata.gz: 6322d1af0ee5027a7cdbdf56bf3b9e837dbd55e3f3a6bb1550ec3f9de9d08390
4
+ data.tar.gz: 1ec9da3d0aa4e905906c0640f80eebf6c7b635565264ddcf455f9f2ee8912b4d
5
5
  SHA512:
6
- metadata.gz: e440f952a3259ac4875b93f463ce338fd8932dfc71bd001d66dea2e5ec60022974a0547143101b0be306db168a5db48dd4b8e7d1c34a7a3ba58a7c0f9f3d6b87
7
- data.tar.gz: 49c2168e1c593f18f227e7cad45d097330b5f52e35b45a94351f81fc750a6b6d237fecb55df0307fa76db48374696a9639c496bb30858e5b450f37be01b90666
6
+ metadata.gz: 3c52d141ba0f4f743fc24cf60f21a6fc2273f28025c87a571ead35981d97f525daaf6ac6c7d75baab784281ac1a44ffb0507b65d2f6c732239a945eb921cdae0
7
+ data.tar.gz: ffd154f4d1d7783bfb339d1048958a76f23ea077560188d9a33919b41a7f4818dd554cea643ce7e686e3d23ae6ca0e5aea0473405c973bb40f27f1acd1e2f6c6
@@ -62,19 +62,11 @@ class SccAccount < ApplicationRecord
62
62
  cached_repository.save!
63
63
  upstream_repo_ids << ur['id']
64
64
  end
65
- # delete repositories beeing removed upstream (Active record seems to be wrong here...)
66
- # scc_repositories.where.not(scc_id: upstream_repo_ids).delete_all
67
- if upstream_repo_ids.empty?
68
- urid_query_fragment = ''
69
- else
70
- upstream_repo_ids_str = upstream_repo_ids.map do |id|
71
- ActiveRecord::Base.connection.quote(id)
72
- end.join(',')
73
- urid_query_fragment = " and scc_repositories.scc_id not in (#{upstream_repo_ids_str})"
74
- end
75
- ActiveRecord::Base.connection.execute(
76
- "delete from scc_repositories where scc_repositories.scc_account_id = #{ActiveRecord::Base.connection.quote(id)}#{urid_query_fragment};"
77
- )
65
+ logger.debug "Found #{upstream_repo_ids.length} repositories"
66
+ # delete repositories beeing removed upstream
67
+ to_delete = scc_repositories.where.not(scc_id: upstream_repo_ids)
68
+ logger.debug "Deleting #{to_delete.count} old repositories"
69
+ to_delete.destroy_all
78
70
  end
79
71
 
80
72
  def update_scc_products(upstream_products)
@@ -93,19 +85,11 @@ class SccAccount < ApplicationRecord
93
85
  cached_product.save!
94
86
  upstream_product_ids << up['id']
95
87
  end
96
- # delete products beeing removed upstream (Active record seems to be wrong here...)
97
- # scc_products.where.not(scc_id: upstream_product_ids).delete_all
98
- if upstream_product_ids.empty?
99
- upid_query_fragment = ''
100
- else
101
- upstream_product_ids_str = upstream_product_ids.map do |id|
102
- ActiveRecord::Base.connection.quote(id)
103
- end.join(',')
104
- upid_query_fragment = " and scc_products.scc_id not in (#{upstream_product_ids_str})"
105
- end
106
- ActiveRecord::Base.connection.execute(
107
- "delete from scc_products where scc_products.scc_account_id = #{ActiveRecord::Base.connection.quote(id)}#{upid_query_fragment};"
108
- )
88
+ logger.debug "Found #{upstream_product_ids.length} products"
89
+ # delete products beeing removed upstream
90
+ to_delete = scc_products.where.not(scc_id: upstream_product_ids)
91
+ logger.debug "Deleting #{to_delete.count} old products"
92
+ to_delete.destroy_all
109
93
  # rewire product to product relationships
110
94
  upstream_products.each do |up|
111
95
  extensions = scc_products.where(scc_id: up['extensions'].map { |ext| ext['id'] })
@@ -1,3 +1,3 @@
1
1
  module ForemanSccManager
2
- VERSION = '1.6.0'.freeze
2
+ VERSION = '1.6.1'.freeze
3
3
  end
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.6.0
4
+ version: 1.6.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: 2019-01-14 00:00:00.000000000 Z
11
+ date: 2019-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc