Sha256: 639effac59a56bccf71a2b531ee12897c1599714d258890528f1715ad7089c82

Contents?: true

Size: 1000 Bytes

Versions: 2

Compression:

Stored size: 1000 Bytes

Contents

module ForemanInventoryUpload
  class UploadsSettingsController < ::ApplicationController
    def index
      render json: {
        autoUploadEnabled: Setting[:allow_auto_inventory_upload],
        hostObfuscationEnabled: Setting[:obfuscate_inventory_hostnames],
        ipsObfuscationEnabled: Setting[:obfuscate_inventory_ips],
        excludePackagesEnabled: Setting[:exclude_installed_packages],
        CloudConnectorStatus: ForemanInventoryUpload::UploadsSettingsController.cloud_connector_status,
        cloudToken: !Setting[:rh_cloud_token].empty?,
      }, status: :ok
    end

    def set_advanced_setting
      Setting[params.require(:setting)] = ActiveModel::Type::Boolean.new.cast(params.require(:value))
      index
    end

    def self.cloud_connector_status
      cloud_connector = ForemanRhCloud::CloudConnector.new
      job = cloud_connector&.latest_job
      return nil unless job
      { id: job.id, task: ForemanTasks::Task.where(:id => job.task_id).first }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.18.1 app/controllers/foreman_inventory_upload/uploads_settings_controller.rb
foreman_rh_cloud-3.0.18 app/controllers/foreman_inventory_upload/uploads_settings_controller.rb