foreman_rh_cloud 13.2.2 → 13.2.4
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/services/foreman_rh_cloud/insights_api_forwarder.rb +12 -5
- data/lib/foreman_inventory_upload.rb +23 -8
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/package.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 626ea42063dcd5c2b6ab1c8548b99039a64eb49570e828e416699a05e3fd8e4e
|
|
4
|
+
data.tar.gz: a1b14513544d7bf58ac8344364333e8517eaee6a444f57aab61a0b4efe8b6807
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9fc3cfd8db7340f6262802328a902ffe72fb68157ba2dbff2d85fa66c5e683144ac7fe38989e0e2fafbf2e2a39bd358723454438feec4699554e9e0985699082
|
|
7
|
+
data.tar.gz: 39c5017bb1d123f6e960e9cd7ed6578a4efe2cef613b9a808c4345a0aa89b6218c956de88175091417499f966bd06c950648442a887371cbee5f8ce4a34e05e5
|
|
@@ -224,14 +224,21 @@ module ForemanRhCloud
|
|
|
224
224
|
def scope_request?(original_request, path)
|
|
225
225
|
return nil unless original_request.get?
|
|
226
226
|
|
|
227
|
-
#
|
|
228
|
-
#
|
|
229
|
-
|
|
227
|
+
# Find patterns that match this path AND are relevant for GET requests.
|
|
228
|
+
# A pattern is relevant if it either:
|
|
229
|
+
# - Has tag_name defined (supports scoping)
|
|
230
|
+
# - Has GET permissions defined (explicitly handles GET, even without tags)
|
|
231
|
+
# This ensures patterns like api/vulnerability/v1/cves/[^/]+$ (GET without tags)
|
|
232
|
+
# take precedence over general patterns, while POST-only patterns are ignored.
|
|
233
|
+
matching_patterns = SCOPED_REQUESTS.select do |pattern|
|
|
234
|
+
pattern[:test].match?(path) && (pattern[:tag_name] || pattern.dig(:permissions, 'GET'))
|
|
235
|
+
end
|
|
230
236
|
return nil if matching_patterns.empty?
|
|
231
237
|
|
|
232
|
-
# Choose the most specific pattern by regex source length
|
|
233
|
-
# with required_permission_for behavior
|
|
238
|
+
# Choose the most specific pattern by regex source length
|
|
234
239
|
request_pattern = matching_patterns.max_by { |pattern| pattern[:test].source.length }
|
|
240
|
+
|
|
241
|
+
# Return the tag_name (may be nil if the most specific pattern doesn't support tags)
|
|
235
242
|
request_pattern[:tag_name]
|
|
236
243
|
end
|
|
237
244
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
module ForemanInventoryUpload
|
|
2
2
|
def self.base_folder
|
|
3
3
|
# in production setup, where selinux is enabled, we only have rights to
|
|
4
|
-
# create folders under /
|
|
5
|
-
# a dev setup, where we can use
|
|
4
|
+
# create folders under /var/lib/foreman. If the folder does not exist, it's
|
|
5
|
+
# a dev setup, where we can use the parent of the current working directory
|
|
6
6
|
@base_folder ||= File.join(
|
|
7
|
-
Dir.glob('/var/lib/foreman').first || Dir.getwd,
|
|
7
|
+
Dir.glob('/var/lib/foreman').first || File.dirname(Dir.getwd),
|
|
8
8
|
'red_hat_inventory/'
|
|
9
9
|
)
|
|
10
10
|
end
|
|
@@ -30,11 +30,6 @@ module ForemanInventoryUpload
|
|
|
30
30
|
File.join(ForemanInventoryUpload.done_folder, filename)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
def self.report_file_paths(organization_id)
|
|
34
|
-
filename = facts_archive_name(organization_id)
|
|
35
|
-
Dir[ForemanInventoryUpload.uploads_file_path(filename), ForemanInventoryUpload.done_file_path(filename)]
|
|
36
|
-
end
|
|
37
|
-
|
|
38
33
|
def self.generated_reports_folder
|
|
39
34
|
@generated_reports_folder ||= ensure_folder(
|
|
40
35
|
File.join(
|
|
@@ -44,6 +39,26 @@ module ForemanInventoryUpload
|
|
|
44
39
|
)
|
|
45
40
|
end
|
|
46
41
|
|
|
42
|
+
def self.generated_reports_file_path(filename)
|
|
43
|
+
File.join(ForemanInventoryUpload.generated_reports_folder, filename)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.report_file_paths(organization_id)
|
|
47
|
+
filename = facts_archive_name(organization_id)
|
|
48
|
+
# Report files start in generated
|
|
49
|
+
# They are then MOVED (not copied) to uploads, then done.
|
|
50
|
+
# When they are moved to the new folder, they overwrite any file with the same name.
|
|
51
|
+
# If it's a generate-only, it will be in generated
|
|
52
|
+
# Failed or incomplete uploads will be in uploads
|
|
53
|
+
# Completed uploads will be in done
|
|
54
|
+
# The ordering here ensures we get the correct file path every time.
|
|
55
|
+
Dir[
|
|
56
|
+
ForemanInventoryUpload.generated_reports_file_path(filename),
|
|
57
|
+
ForemanInventoryUpload.uploads_file_path(filename),
|
|
58
|
+
ForemanInventoryUpload.done_file_path(filename),
|
|
59
|
+
]
|
|
60
|
+
end
|
|
61
|
+
|
|
47
62
|
def self.outputs_folder
|
|
48
63
|
@outputs_folder ||= ensure_folder(File.join(ForemanInventoryUpload.base_folder, 'outputs/'))
|
|
49
64
|
end
|
data/package.json
CHANGED