Class: ForemanInventoryUpload::Generators::Queries
- Inherits:
-
Object
- Object
- ForemanInventoryUpload::Generators::Queries
- Defined in:
- lib/foreman_inventory_upload/generators/queries.rb
Class Method Summary collapse
- .fact_names ⇒ Object
- .for_org(organization_id, use_batches: true, hosts_query: '') ⇒ Object
- .for_slice(base) ⇒ Object
Class Method Details
.fact_names ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/foreman_inventory_upload/generators/queries.rb', line 4 def self.fact_names @fact_names ||= Hash[ Katello::RhsmFactName.where(name: [ 'dmi::system::uuid', 'virt::uuid', 'cpu::cpu(s)', 'cpu::cpu_socket(s)', 'cpu::core(s)_per_socket', 'memory::memtotal', 'dmi::bios::vendor', 'dmi::bios::version', 'dmi::bios::relase_date', 'distribution::name', 'uname::release', 'lscpu::flags', 'hypervisor::type', 'hypervisor::version', 'distribution::version', 'distribution::id', 'virt::is_guest', 'dmi::system::manufacturer', 'dmi::system::product_name', 'dmi::chassis::asset_tag', 'insights_client::obfuscate_hostname_enabled', 'insights_client::obfuscate_ipv4_enabled', 'insights_client::obfuscate_ipv6_enabled', 'insights_client::obfuscated_ipv4', 'insights_client::obfuscated_ipv6', 'insights_client::obfuscated_hostname', 'insights_id', 'conversions::activity', 'conversions::packages::0::nevra', 'conversions::packages::0::signature', 'conversions::activity_started', 'conversions::activity_ended', 'conversions::success', 'conversions::source_os::name', 'conversions::source_os::version', 'conversions::target_os::name', 'conversions::target_os::version', ]).pluck(:name, :id) ] end |
.for_org(organization_id, use_batches: true, hosts_query: '') ⇒ Object
63 64 65 66 |
# File 'lib/foreman_inventory_upload/generators/queries.rb', line 63 def self.for_org(organization_id, use_batches: true, hosts_query: '') base_query = for_slice(Host.unscoped.where(organization_id: organization_id).search_for(hosts_query)) use_batches ? base_query.in_batches(of: ForemanInventoryUpload.slice_size) : base_query end |
.for_slice(base) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/foreman_inventory_upload/generators/queries.rb', line 49 def self.for_slice(base) base .search_for("not params.#{InsightsCloud.enable_client_param_inventory} = f") .joins(:subscription_facet) .preload( :interfaces, :installed_packages, :content_facet, :host_statuses, :inventory_upload_facts, subscription_facet: [:pools, :installed_products, :hypervisor_host] ) end |