Sha256: 128abc0195e30d62fe51ffafa55004d7444152a714e35c44bee7e371ffac5ee1

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

require 'manageiq-gems-pending'
require 'ostruct'
require 'log4r'
require 'MiqVm/MiqVm'

class ConsoleFormatter < Log4r::Formatter
  def format(event)
    (event.data.kind_of?(String) ? event.data : event.data.inspect) + "\n"
  end
end

$log = Log4r::Logger.new 'toplog'
Log4r::StderrOutputter.new('err_console', :level => Log4r::DEBUG, :formatter => ConsoleFormatter)
$log.add 'err_console'

VHD = raise "Please define VHD"
diskid    = "ide0:0"
hardware  = "#{diskid}.present = \"TRUE\"\n"
hardware += "#{diskid}.filename = \"#{VHD}\"\n"

begin
  ost = OpenStruct.new
  ost.fileName = VHD
  vm = MiqVm.new(hardware, ost)

  vm.rootTrees.each do |fs|
    puts "*** Found root tree for #{fs.guestOS}"
    puts "Listing files in #{fs.pwd} directory:"
    fs.dirEntries.each { |de| puts "\t#{de}" }
    puts
  end

  CATEGORIES	= %w(accounts services software system)
  CATEGORIES.each do |cat|
    puts "Extracting: #{cat}:"
    xml = vm.extract(cat)
    xml.write($stdout, 4)
    puts
  end

  vm.unmount
rescue => err
  puts err.to_s
  puts err.backtrace.join("\n")
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
manageiq-smartstate-0.2.1 lib/MiqVm/test/localVm.rb
manageiq-smartstate-0.2.0 lib/MiqVm/test/localVm.rb
manageiq-smartstate-0.1.6 lib/MiqVm/test/localVm.rb
manageiq-smartstate-0.1.5 lib/MiqVm/test/localVm.rb
manageiq-smartstate-0.1.4 lib/MiqVm/test/localVm.rb
manageiq-smartstate-0.1.3 lib/MiqVm/test/localVm.rb
manageiq-smartstate-0.1.2 lib/MiqVm/test/localVm.rb
manageiq-smartstate-0.1.1 lib/MiqVm/test/localVm.rb
manageiq-smartstate-0.1.0 lib/MiqVm/test/localVm.rb