Sha256: eaa5dfe949c8ba8bd9ec6339aa54da1951c10c265ff20a0e9b62f096656a1962

Contents?: true

Size: 1016 Bytes

Versions: 60

Compression:

Stored size: 1016 Bytes

Contents

module CfgConfig
  def convert(filename)
    @convertText = ""
    $log.debug "Processing Windows Configuration file [#{filename}]"
    begin
      fh = File.open(filename)
      fh.each do |line|
        line.AsciiToUtf8!.strip!
        next if line.length == 0
        next if line =~ /^#.*$/
        next unless line.include?("=")
        k, v = line.split(/\s*=\s*/)
        send(k, v) if self.respond_to?(k)
      end
      return @convertText
    ensure
      fh.close
    end
  end

  def name(value)
    vmName = value.gsub(/^"/, "").gsub(/"$/, "")
    add_item("displayName", vmName)
  end

  def memory(value)
    add_item("memsize", value)
  end

  def disk(value)
    eval(value).each do |d|
      diskProp = d.split(",")
      # scsi0:0.fileName = "Windows XP Professional x64 Edition.vmdk"
      add_item("scsi0:#{diskProp[1][-1..-1]}.fileName", File.basename(diskProp[0]))
    end
  end

  def add_item(var, value)
    @convertText += "#{var} = \"#{value}\"\n"
  end

  def vendor
    "xen"
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
manageiq-smartstate-0.3.4 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.4.0 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.18.2 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.3.3 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.3.2 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.3.1 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.3.0 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.24 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.18.1 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.23 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.22 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.21 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.20 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.19 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.18 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.17 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.16 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.15 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.14 lib/metadata/VmConfig/cfgConfig.rb
manageiq-smartstate-0.2.13 lib/metadata/VmConfig/cfgConfig.rb