Skip to content

Commit

Permalink
Fix scheduled task for uploading report failed (#874)
Browse files Browse the repository at this point in the history
(cherry picked from commit 210d322)
  • Loading branch information
sbernhard authored and chris1984 committed Mar 22, 2024
1 parent 1983a18 commit ecbafcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/controllers/api/v2/rh_cloud/inventory_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def download_file

api :POST, "/organizations/:organization_id/rh_cloud/report", N_("Start report generation")
param :organization_id, Integer, required: true, desc: N_("Set the current organization context for the request")
param :disconnected, :bool, required: false, desc: N_('Generate the report, but do not upload')
param :disconnected, :bool, required: false, default: false, desc: N_('Generate the report, but do not upload')
def generate_report
organization_id = params[:organization_id]
disconnected = params[:disconnected]
disconnected = params[:disconnected] || false

start_report_generation(organization_id, disconnected)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def plan
total_hosts = ForemanInventoryUpload::Generators::Queries.for_org(organization.id, use_batches: false).count

if total_hosts <= ForemanInventoryUpload.max_org_size
plan_generate_report(ForemanInventoryUpload.generated_reports_folder, organization)
disconnected = false
plan_generate_report(ForemanInventoryUpload.generated_reports_folder, organization, disconnected)
else
logger.info("Skipping automatic uploads for organization #{organization.name}, too many hosts (#{total_hosts}/#{ForemanInventoryUpload.max_org_size})")
end
Expand Down

0 comments on commit ecbafcb

Please sign in to comment.