Method: VmScanItemFile#parse_data

Defined in:
lib/metadata/ScanProfile/modules/VmScanItemFile.rb

#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
        options = {'contents' => d['content']}
        d["data"] = MD5deep.scan_glob(vm.rootTrees[0], d["target"], options) if d["data"].nil?
      rescue
      end
    end
    $log.info "Scanning [Profile-Files] information ran for [#{Time.now - st}] seconds."
  end
end