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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfa11165fb0df8c45bf5e18b6f2611b8e63fc771937efa1288adf0b7b3dce15f
4
- data.tar.gz: a6f2ecf8a2a1de5aa57374535d3c974f6390d40439e0434f4267ce5e521fe05c
3
+ metadata.gz: 626ea42063dcd5c2b6ab1c8548b99039a64eb49570e828e416699a05e3fd8e4e
4
+ data.tar.gz: a1b14513544d7bf58ac8344364333e8517eaee6a444f57aab61a0b4efe8b6807
5
5
  SHA512:
6
- metadata.gz: c590acf7aa733f22104dd673226a3f5652535e27fd6c6dbc2684e21d29adc30fe848db31b772112a0ee8889adb77f1c5795afae7144c9c8cab83106b5c4c052b
7
- data.tar.gz: '02668725a8090ca3c1629e664ac296e716abe6f8da5b1f9dabd4eba297e4dc517f3125439ff9ac5825dfb1225c48b6f507ea0a0803ab1217eebcd87db9b95c2a'
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
- # Only consider patterns that define tag_name - this ensures patterns without
228
- # tag_name (permission-only entries) cannot override tag-supporting patterns
229
- matching_patterns = SCOPED_REQUESTS.select { |pattern| pattern[:tag_name] && pattern[:test].match?(path) }
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 for consistency
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 /ver/lib/foreman. If the folder does not exist, it's
5
- # a dev setup, where we can use our current root
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
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '13.2.2'.freeze
2
+ VERSION = '13.2.4'.freeze
3
3
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "13.2.2",
3
+ "version": "13.2.4",
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_rh_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.2.2
4
+ version: 13.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Red Hat Cloud team