Sha256: f8150df55ef9cc00fde2dde6e0f856cc9592b172bd77f9fd29b782e71633e115
Contents?: true
Size: 943 Bytes
Versions: 41
Compression:
Stored size: 943 Bytes
Contents
module ForemanInventoryUpload module Generators class Metadata def initialize(output = []) @stream = JsonStream.new(output) end def add_slice(slice_id, hosts_count, first) @stream.comma unless first @stream.object_field(slice_id, :last) do @stream.simple_field('number_hosts', hosts_count, :last) end end def render(metadata = nil, &block) render_report(metadata, &block) @stream.out end private def render_report(metadata) @stream.object do @stream.simple_field('report_id', Foreman.uuid) @stream.simple_field('host_inventory_api_version', '1.0') @stream.simple_field('source', 'Satellite') @stream.simple_field('source_metadata', metadata) @stream.object_field('report_slices', :last) do yield(self) end end end end end end
Version data entries
41 entries across 41 versions & 2 rubygems