Class: ForemanInventoryUpload::Generators::Slice

Inherits:
Object
  • Object
show all
Includes:
FactHelpers
Defined in:
lib/foreman_inventory_upload/generators/slice.rb

Constant Summary collapse

SATELLITE_NAMESPACE =
'satellite'
SATELLITE_PARAMS_NAMESPACE =
'satellite_parameter'

Constants included from FactHelpers

FactHelpers::CLOUD_ALIBABA, FactHelpers::CLOUD_AMAZON, FactHelpers::CLOUD_AZURE, FactHelpers::CLOUD_GOOGLE, FactHelpers::UUID_REGEX

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FactHelpers

#account_id, #bios_uuid, #cloud_provider, #fact_value, #fqdn, #golden_ticket?, #host_ips, #hostname_match, #kilobytes_to_bytes, #obfuscate_fqdn, #obfuscate_hostname?, #obfuscate_ip, #obfuscate_ips?, #obfuscated_ips, #uuid_value, #uuid_value!

Constructor Details

#initialize(hosts, output = [], slice_id = Foreman.uuid) ⇒ Slice

Returns a new instance of Slice.



12
13
14
15
16
17
# File 'lib/foreman_inventory_upload/generators/slice.rb', line 12

def initialize(hosts, output = [], slice_id = Foreman.uuid)
  @stream = JsonStream.new(output)
  @hosts = hosts
  @slice_id = slice_id
  @hosts_count = 0
end

Instance Attribute Details

#hosts_countObject (readonly)

Returns the value of attribute hosts_count.



10
11
12
# File 'lib/foreman_inventory_upload/generators/slice.rb', line 10

def hosts_count
  @hosts_count
end

#slice_idObject

Returns the value of attribute slice_id.



9
10
11
# File 'lib/foreman_inventory_upload/generators/slice.rb', line 9

def slice_id
  @slice_id
end

Instance Method Details

#renderObject



19
20
21
22
# File 'lib/foreman_inventory_upload/generators/slice.rb', line 19

def render
  report_slice(@hosts)
  @stream.out
end