foreman_rh_cloud 8.0.51 → 8.0.52
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/rh_cloud/inventory_controller.rb +3 -1
- data/app/controllers/concerns/inventory_upload/report_actions.rb +2 -2
- data/app/controllers/foreman_inventory_upload/reports_controller.rb +2 -1
- data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +2 -2
- data/lib/foreman_inventory_upload/async/generate_report_job.rb +3 -2
- data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +2 -2
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/tasks/rh_cloud_inventory.rake +2 -1
- data/package.json +1 -1
- data/test/controllers/inventory_upload/api/inventory_controller_test.rb +3 -2
- 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: c1d1f1eec1e7f83d5fea8b52102c9966fd8429dd01368150b5c4448ea9d5cb92
|
4
|
+
data.tar.gz: 3ecdf1a64c836187cafca7c27b9fba8cef99bb7094f3d09e2dfd085295b8f18e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd8dd41fd2ffbb9f66b075e4dbe73e64f9439dedc08974d73851f6a37262ff26b87fb376df6f8ce5817ee9e90bb185185805b3e5f1bd9f63120919a962794a9f
|
7
|
+
data.tar.gz: 4ea0b00bd56be43485483107665dd9fab550dd362fc9e4784732b8174aed5f23527816ee320c7bf00b244f22601c60acf1386791c94909a301ff55cf250d9127
|
@@ -18,10 +18,12 @@ module Api
|
|
18
18
|
|
19
19
|
api :POST, "/organizations/:organization_id/rh_cloud/report", N_("Start report generation")
|
20
20
|
param :organization_id, Integer, required: true, desc: N_("Set the current organization context for the request")
|
21
|
+
param :disconnected, :bool, required: false, desc: N_('Generate the report, but do not upload')
|
21
22
|
def generate_report
|
22
23
|
organization_id = params[:organization_id]
|
24
|
+
disconnected = params[:disconnected]
|
23
25
|
|
24
|
-
start_report_generation(organization_id)
|
26
|
+
start_report_generation(organization_id, disconnected)
|
25
27
|
|
26
28
|
render json: {
|
27
29
|
action_status: 'success',
|
@@ -10,8 +10,8 @@ module InventoryUpload
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def start_report_generation(organization_id)
|
14
|
-
ForemanTasks.async_task(ForemanInventoryUpload::Async::GenerateReportJob, ForemanInventoryUpload.generated_reports_folder, organization_id)
|
13
|
+
def start_report_generation(organization_id, disconnected)
|
14
|
+
ForemanTasks.async_task(ForemanInventoryUpload::Async::GenerateReportJob, ForemanInventoryUpload.generated_reports_folder, organization_id, disconnected)
|
15
15
|
end
|
16
16
|
|
17
17
|
def report_file(organization_id)
|
@@ -21,8 +21,9 @@ module ForemanInventoryUpload
|
|
21
21
|
|
22
22
|
def generate
|
23
23
|
organization_id = params[:organization_id]
|
24
|
+
disconnected = params[:disconnected]
|
24
25
|
|
25
|
-
start_report_generation(organization_id)
|
26
|
+
start_report_generation(organization_id, disconnected)
|
26
27
|
|
27
28
|
render json: {
|
28
29
|
action_status: 'success',
|
@@ -32,8 +32,8 @@ module ForemanInventoryUpload
|
|
32
32
|
Dynflow::Action::Rescue::Fail
|
33
33
|
end
|
34
34
|
|
35
|
-
def plan_generate_report(folder, organization)
|
36
|
-
plan_action(ForemanInventoryUpload::Async::GenerateReportJob, folder, organization.id)
|
35
|
+
def plan_generate_report(folder, organization, disconnected)
|
36
|
+
plan_action(ForemanInventoryUpload::Async::GenerateReportJob, folder, organization.id, disconnected)
|
37
37
|
end
|
38
38
|
|
39
39
|
def logger
|
@@ -5,7 +5,7 @@ module ForemanInventoryUpload
|
|
5
5
|
"report_for_#{label}"
|
6
6
|
end
|
7
7
|
|
8
|
-
def plan(base_folder, organization_id)
|
8
|
+
def plan(base_folder, organization_id, disconnected)
|
9
9
|
sequence do
|
10
10
|
super(
|
11
11
|
GenerateReportJob.output_label(organization_id),
|
@@ -17,7 +17,8 @@ module ForemanInventoryUpload
|
|
17
17
|
QueueForUploadJob,
|
18
18
|
base_folder,
|
19
19
|
ForemanInventoryUpload.facts_archive_name(organization_id),
|
20
|
-
organization_id
|
20
|
+
organization_id,
|
21
|
+
disconnected
|
21
22
|
)
|
22
23
|
end
|
23
24
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module ForemanInventoryUpload
|
2
2
|
module Async
|
3
3
|
class QueueForUploadJob < ::Actions::EntryAction
|
4
|
-
def plan(base_folder, report_file, organization_id)
|
4
|
+
def plan(base_folder, report_file, organization_id, disconnected)
|
5
5
|
enqueue_task = plan_self(base_folder: base_folder, report_file: report_file)
|
6
|
-
plan_upload_report(enqueue_task.output[:enqueued_file_name], organization_id)
|
6
|
+
plan_upload_report(enqueue_task.output[:enqueued_file_name], organization_id) unless disconnected
|
7
7
|
end
|
8
8
|
|
9
9
|
def run
|
@@ -47,7 +47,8 @@ namespace :rh_cloud_inventory do
|
|
47
47
|
base_folder = ENV['target'] || ForemanInventoryUpload.generated_reports_folder
|
48
48
|
organization_id = ENV['organization_id']
|
49
49
|
report_file = ForemanInventoryUpload.facts_archive_name(organization_id)
|
50
|
-
|
50
|
+
disconnected = false
|
51
|
+
ForemanTasks.sync_task(ForemanInventoryUpload::Async::QueueForUploadJob, base_folder, report_file, organization_id, disconnected)
|
51
52
|
puts "Uploaded #{report_file}"
|
52
53
|
end
|
53
54
|
end
|
data/package.json
CHANGED
@@ -6,14 +6,15 @@ module InventoryUpload::Api
|
|
6
6
|
|
7
7
|
setup do
|
8
8
|
@test_org = FactoryBot.create(:organization)
|
9
|
+
@disconnected = false
|
9
10
|
end
|
10
11
|
|
11
12
|
test 'Starts report generation' do
|
12
13
|
Api::V2::RhCloud::InventoryController.any_instance
|
13
14
|
.expects(:start_report_generation)
|
14
|
-
.with(@test_org.id.to_s)
|
15
|
+
.with(@test_org.id.to_s, @disconnected)
|
15
16
|
|
16
|
-
post :generate_report, params: { organization_id: @test_org.id }
|
17
|
+
post :generate_report, params: { organization_id: @test_org.id, disconnected: @disconnected}
|
17
18
|
|
18
19
|
assert_response :success
|
19
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_rh_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.
|
4
|
+
version: 8.0.52
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katello
|