properties-reader возвращает нулевые свойства - PullRequest
1 голос
/ 29 марта 2020

Во-первых, английский sh не мой родной язык. Извините, если есть ошибка!

У меня проблема с модулем properties-reader . Строка имеет хороший формат (см. Ниже), она просто не работает для определенных свойств

код:

function foo(properties : string)
{
    let reader = PropertiesReader(null).read(properties);

    let hddSize = reader.getRaw("vmotion.checkpointSVGAPrimarySize");
    let ram = reader.getRaw("memSize");

    console.log(hddSize);
    //output foo
    console.log(ram);
    //output : null
}

Вывод строки свойств:

.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "14"
vmci0.present = "TRUE"
floppy0.present = "FALSE"
memSize = "2048"
bios.bootRetry.delay = "10"
powerType.suspend = "soft"
tools.upgrade.policy = "manual"
sched.cpu.units = "mhz"
sched.cpu.affinity = "all"
vm.createDate = "1583449297184034"
scsi0.virtualDev = "lsilogic"
scsi0.present = "TRUE"
sata0.present = "TRUE"
usb.present = "TRUE"
ehci.present = "TRUE"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.fileName = "9898.vmdk"
sched.scsi0:0.shares = "normal"
sched.scsi0:0.throughputCap = "off"
scsi0:0.present = "TRUE"
ethernet0.virtualDev = "vmxnet3"
ethernet0.networkName = "VM Network"
ethernet0.addressType = "generated"
ethernet0.wakeOnPcktRcv = "FALSE"
ethernet0.uptCompatibility = "TRUE"
ethernet0.present = "TRUE"
sata0:0.deviceType = "atapi-cdrom"
sata0:0.fileName = "/vmfs/devices/cdrom/mpx.vmhba64:C0:T0:L0"
sata0:0.present = "TRUE"
displayName = "9898"
guestOS = "ubuntu-64"
toolScripts.afterPowerOn = "TRUE"
toolScripts.afterResume = "TRUE"
toolScripts.beforeSuspend = "TRUE"
toolScripts.beforePowerOff = "TRUE"
tools.syncTime = "FALSE"
uuid.bios = "56 4d 56 9c b9 ab 3a a8-e7 cc 0b 24 a8 0e ed 22"
uuid.location = "56 4d 56 9c b9 ab 3a a8-e7 cc 0b 24 a8 0e ed 22"
vc.uuid = "52 06 9c de 7b e1 f4 a9-5d ac cf 9c 67 b0 7c ca"
sched.cpu.min = "0"
sched.cpu.shares = "normal"
sched.mem.min = "0"
sched.mem.minSize = "0"
sched.mem.shares = "normal"
ethernet0.generatedAddress = "00:0c:29:0e:ed:22"
vmci0.id = "-1475416797"
cleanShutdown = "TRUE"
numa.autosize.cookie = "20001"
numa.autosize.vcpu.maxPerVirtualNode = "2"
tools.guest.desktop.autolock = "FALSE"
nvram = "9898.nvram"
pciBridge0.present = "TRUE"
svga.present = "TRUE"
pciBridge4.present = "TRUE"
pciBridge4.virtualDev = "pcieRootPort"
pciBridge4.functions = "8"
pciBridge5.present = "TRUE"
pciBridge5.virtualDev = "pcieRootPort"
pciBridge5.functions = "8"
pciBridge6.present = "TRUE"
pciBridge6.virtualDev = "pcieRootPort"
pciBridge6.functions = "8"
pciBridge7.present = "TRUE"
pciBridge7.virtualDev = "pcieRootPort"
pciBridge7.functions = "8"
hpet0.present = "TRUE"
RemoteDisplay.maxConnections = "-1"
sched.cpu.latencySensitivity = "normal"
svga.autodetect = "TRUE"
sched.swap.derivedName = "/vmfs/volumes/5e59916a-a0598b15-51b8-000c295de52d/9898/9898-9f63ebe0.vswp"
pciBridge0.pciSlotNumber = "17"
pciBridge4.pciSlotNumber = "21"
pciBridge5.pciSlotNumber = "22"
pciBridge6.pciSlotNumber = "23"
pciBridge7.pciSlotNumber = "24"
scsi0.pciSlotNumber = "16"
usb.pciSlotNumber = "32"
ethernet0.pciSlotNumber = "160"
ehci.pciSlotNumber = "33"
vmci0.pciSlotNumber = "34"
sata0.pciSlotNumber = "35"
ethernet0.generatedAddressOffset = "0"
monitor.phys_bits_used = "43"
vmotion.checkpointFBSize = "4194304"
vmotion.checkpointSVGAPrimarySize = "16777216"
softPowerOff = "FALSE"
usb:1.speed = "2"
usb:1.present = "TRUE"
usb:1.deviceType = "hub"
usb:1.port = "1"
usb:1.parent = "-1"
svga.guestBackedPrimaryAware = "TRUE"
usb:0.present = "TRUE"
usb:0.deviceType = "hid"
usb:0.port = "0"
usb:0.parent = "-1"
migrate.hostLog = "./9898-9f63ebe0.hlog"

Когда я сохраняю все сохраненные свойства с помощью console.log(reader.getAllProperties());, я получаю следующий вывод:

  '.encoding': '"UTF-8"',
  'config.version': '"8"',
  'virtualHW.version': '"14"',
  'vmci0.present': '"TRUE"',
  'floppy0.present': '"FALSE"',
  memSize: '"2048"',
  'bios.bootRetry.delay': '"10"',
  'powerType.suspend': '"soft"',
  'tools.upgrade.policy': '"manual"',
  'sched.cpu.units': '"mhz"',
  'sched.cpu.affinity': '"all"',
  'vm.createDate': '"1583449297184034"',
  'scsi0.virtualDev': '"lsilogic"',
  'scsi0.present': '"TRUE"',
  'sata0.present': '"TRUE"',
  'usb.present': '"TRUE"',
  'ehci.present': '"TRUE"',
  'scsi0:0.deviceType': '"scsi-hardDisk"',
  'scsi0:0.fileName': '"9898.vmdk"',
  'sched.scsi0:0.shares': '"normal"',
  'sched.scsi0:0.throughputCap': '"off"',
  'scsi0:0.present': '"TRUE"',
  'ethernet0.virtualDev': '"vmxnet3"',
  'ethernet0.networkName': '"VM Network"',
  'ethernet0.addressType': '"generated"',
  'ethernet0.wakeOnPcktRcv': '"FALSE"',
  'ethernet0.uptCompatibility': '"TRUE"',
  'ethernet0.present': '"TRUE"',
  'sata0:0.deviceType': '"atapi-cdrom"',
  'sata0:0.fileName': '"/vmfs/devices/cdrom/mpx.vmhba64:C0:T0:L0"',
  'sata0:0.present': '"TRUE"',
  displayName: '"9898"',
  guestOS: '"ubuntu-64"',
  'toolScripts.afterPowerOn': '"TRUE"',
  'toolScripts.afterResume': '"TRUE"',
  'toolScripts.beforeSuspend': '"TRUE"',
  'toolScripts.beforePowerOff': '"TRUE"',
  'tools.syncTime': '"FALSE"',
  'uuid.bios': '"56 4d 56 9c b9 ab 3a a8-e7 cc 0b 24 a8 0e ed 22"',
  'uuid.location': '"56 4d 56 9c b9 ab 3a a8-e7 cc 0b 24 a8 0e ed 22"',
  'vc.uuid': '"52 06 9c de 7b e1 f4 a9-5d ac cf 9c 67 b0 7c ca"',
  'sched.cpu.min': '"0"',
  'sched.cpu.shares': '"normal"',
  'sched.mem.min': '"0"',
  'sched.mem.minSize': '"0"',
  'sched.mem.shares': '"normal"',
  'ethernet0.generatedAddress': '"00:0c:29:0e:ed:22"',
  'vmci0.id': '"-1475416797"',
  cleanShutdown: '"TRUE"',
  'numa.autosize.cookie': '"20001"',
  'numa.autosize.vcpu.maxPerVirtualNode': '"2"',
  'tools.guest.desktop.autolock': '"FALSE"',
  nvram: '"9898.nvram"',
  'pciBridge0.present': '"TRUE"',
  'svga.present': '"TRUE"',
  'pciBridge4.present': '"TRUE"',
  'pciBridge4.virtualDev': '"pcieRootPort"',
  'pciBridge4.functions': '"8"',
  'pciBridge5.present': '"TRUE"',
  'pciBridge5.virtualDev': '"pcieRootPort"',
  'pciBridge5.functions': '"8"',
  'pciBridge6.present': '"TRUE"',
  'pciBridge6.virtualDev': '"pcieRootPort"',
  'pciBridge6.functions': '"8"',
  'pciBridge7.present': '"TRUE"',
  'pciBridge7.virtualDev': '"pcieRootPort"',
  'pciBridge7.functions': '"8"',
  'hpet0.present': '"TRUE"',
  'RemoteDisplay.maxConnections': '"-1"',
  'sched.cpu.latencySensitivity': '"normal"',
  'svga.autodetect': '"TRUE"',
  'sched.swap.derivedName': '"/vmfs/volumes/5e59916a-a0598b15-51b8-000c295de52d/9898/9898-9f63ebe0.vswp"',
  'pciBridge0.pciSlotNumber': '"17"',
  'pciBridge4.pciSlotNumber': '"21"',
  'pciBridge5.pciSlotNumber': '"22"',
  'pciBridge6.pciSlotNumber': '"23"',
  'pciBridge7.pciSlotNumber': '"24"',
  'scsi0.pciSlotNumber': '"16"',
  'usb.pciSlotNumber': '"32"',
  'ethernet0.pciSlotNumber': '"160"',
  'ehci.pciSlotNumber': '"33"',
  'vmci0.pciSlotNumber': '"34"',
  'sata0.pciSlotNumber': '"35"',
  'ethernet0.generatedAddressOffset': '"0"',
  'monitor.phys_bits_used': '"43"',
  'vmotion.checkpointFBSize': '"4194304"',
  'vmotion.checkpointSVGAPrimarySize': '"16777216"',
  softPowerOff: '"FALSE"',
  'usb:1.speed': '"2"',
  'usb:1.present': '"TRUE"',
  'usb:1.deviceType': '"hub"',
  'usb:1.port': '"1"',
  'usb:1.parent': '"-1"',
  'svga.guestBackedPrimaryAware': '"TRUE"',
  'usb:0.present': '"TRUE"',
  'usb:0.deviceType': '"hid"',
  'usb:0.port': '"0"',
  'usb:0.parent': '"-1"',
  'migrate.hostLog': '"./9898-9f63ebe0.hlog"'
}

Все свойства, не заключенные в кавычки, не читаются и всегда возвращают ноль, остальные отлично читаются, это действительно странная проблема .

Если бы вы, ребята, могли бы дать мне некоторое представление, то это было бы здорово!

...