From 74656e4854b932b00c5c8188219c13ec0ea9454d Mon Sep 17 00:00:00 2001 From: Shim Shtein Date: Thu, 21 Mar 2024 15:07:35 +0200 Subject: [PATCH 1/3] Make sure to forward raw_post for patch commands (cherry picked from commit 32866dc50f59c52e30a0ab84602661e22ee3c4ac) --- app/services/foreman_rh_cloud/cloud_request_forwarder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/foreman_rh_cloud/cloud_request_forwarder.rb b/app/services/foreman_rh_cloud/cloud_request_forwarder.rb index 6e765181..1d991dad 100644 --- a/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +++ b/app/services/foreman_rh_cloud/cloud_request_forwarder.rb @@ -38,7 +38,7 @@ def prepare_request_opts(original_request, forward_payload, forward_params, cert def prepare_forward_payload(original_request, controller_name) forward_payload = original_request.request_parameters[controller_name] - forward_payload = original_request.raw_post.clone if original_request.post? && original_request.raw_post + forward_payload = original_request.raw_post.clone if (original_request.post? || original_request.patch?) && original_request.raw_post forward_payload = original_request.body.read if original_request.put? forward_payload = original_request.params.slice(:file, :metadata) if original_request.params[:file] From 2e085e4126c18ed45d2f5ea5460a8d78ceec9332 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Thu, 9 May 2024 04:15:33 -0400 Subject: [PATCH 2/3] Fix forward patch payload test (#884) (cherry picked from commit a13d7dd81e11d733ea49a897a1194ad530abc826) --- .../foreman_rh_cloud/cloud_request_forwarder_test.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb b/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb index 1f953887..c9c22e68 100644 --- a/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +++ b/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb @@ -65,16 +65,15 @@ class CloudRequestForwarderTest < ActiveSupport::TestCase end test 'should forward patch payload' do - params = { 'pumpkin' => 'pie' } + post_data = 'Random PATCH data' req = ActionDispatch::Request.new( 'REQUEST_URI' => '/foo/bar?baz=awesome', 'REQUEST_METHOD' => 'PATCH', 'rack.input' => ::Puma::NullIO.new, - 'RAW_POST_DATA' => 'Random PATCH data', - "action_dispatch.request.path_parameters" => { :format => "json" }, - "action_dispatch.request.request_parameters" => { 'vegetables' => params } + 'RAW_POST_DATA' => post_data, + "action_dispatch.request.path_parameters" => { :format => "json" } ) - assert_equal params.to_json, @forwarder.prepare_forward_payload(req, 'vegetables') + assert_equal post_data, @forwarder.prepare_forward_payload(req, 'Random PATCH data') end test 'should forward file with metadata' do From 63060cfe30cbcb9cbd0cf39a0b1eaa464ee531a7 Mon Sep 17 00:00:00 2001 From: Odilon Sousa Date: Tue, 12 Nov 2024 13:25:57 -0300 Subject: [PATCH 3/3] Bump version to 9.0.59 --- lib/foreman_rh_cloud/version.rb | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/foreman_rh_cloud/version.rb b/lib/foreman_rh_cloud/version.rb index b1b5fd17..03e58783 100644 --- a/lib/foreman_rh_cloud/version.rb +++ b/lib/foreman_rh_cloud/version.rb @@ -1,3 +1,3 @@ module ForemanRhCloud - VERSION = '9.0.58'.freeze + VERSION = '9.0.59'.freeze end diff --git a/package.json b/package.json index 7bc0fa2e..df2e4eda 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foreman_rh_cloud", - "version": "9.0.58", + "version": "9.0.59", "description": "Inventory Upload =============", "main": "index.js", "scripts": {