foreman_scc_manager 1.6.0 → 1.6.1
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/models/scc_account.rb +10 -26
- data/lib/foreman_scc_manager/version.rb +1 -1
- 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: 6322d1af0ee5027a7cdbdf56bf3b9e837dbd55e3f3a6bb1550ec3f9de9d08390
|
4
|
+
data.tar.gz: 1ec9da3d0aa4e905906c0640f80eebf6c7b635565264ddcf455f9f2ee8912b4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c52d141ba0f4f743fc24cf60f21a6fc2273f28025c87a571ead35981d97f525daaf6ac6c7d75baab784281ac1a44ffb0507b65d2f6c732239a945eb921cdae0
|
7
|
+
data.tar.gz: ffd154f4d1d7783bfb339d1048958a76f23ea077560188d9a33919b41a7f4818dd554cea643ce7e686e3d23ae6ca0e5aea0473405c973bb40f27f1acd1e2f6c6
|
data/app/models/scc_account.rb
CHANGED
@@ -62,19 +62,11 @@ class SccAccount < ApplicationRecord
|
|
62
62
|
cached_repository.save!
|
63
63
|
upstream_repo_ids << ur['id']
|
64
64
|
end
|
65
|
-
#
|
66
|
-
#
|
67
|
-
|
68
|
-
|
69
|
-
|
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
|
-
#
|
97
|
-
#
|
98
|
-
|
99
|
-
|
100
|
-
|
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'] })
|
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.
|
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-
|
11
|
+
date: 2019-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|