Module: VmScanItemFile
- Defined in:
- lib/metadata/ScanProfile/modules/VmScanItemFile.rb
Instance Method Summary collapse
Instance Method Details
#parse_data(vm, data, &_blk) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/metadata/ScanProfile/modules/VmScanItemFile.rb', line 22 def parse_data(vm, data, &_blk) if data.nil? st = Time.now $log.info "Scanning [Profile-Files] information." yield({:msg => 'Scanning Profile-File'}) if block_given? scan_definition["stats"].each do |d| # MD5deep scanning will raise an error if the path does not exist. begin # Skip if we already have data for this element = {'contents' => d['content']} d["data"] = MD5deep.scan_glob(vm.rootTrees[0], d["target"], ) if d["data"].nil? rescue end end $log.info "Scanning [Profile-Files] information ran for [#{Time.now - st}] seconds." end end |
#to_xml ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/metadata/ScanProfile/modules/VmScanItemFile.rb', line 2 def to_xml xml = @xml_class.newNode("scan_item") xml.add_attributes("guid" => @params["guid"], "name" => @params["name"], "item_type" => @params["item_type"]) scan_definition['stats'].each do |d| if d["data"] xml_partial = xml.root.add_element("filesystem") xml_partial.add_attributes(d["data"].root.attributes) xml_partial.add_attribute("id", d["target"]) e = d["data"].root.elements[1] until e.blank? xml_partial << e e = d["data"].root.elements[1] end end end xml end |