Skip to content
This repository has been archived by the owner on Jan 8, 2021. It is now read-only.

strip whitespace from platform name #127

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 35 additions & 17 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,23 +708,41 @@ def get_objects(self, vc_obj_type):
results["platforms"].append(nbt.platform(
name=platform,
))
results["virtual_machines"].append(nbt.virtual_machine(
name=truncate(obj_name, max_len=64),
cluster=cluster,
status=int(
1 if obj.runtime.powerState == "poweredOn" else 0
),
role="Server",
platform=platform,
memory=obj.config.hardware.memoryMB,
disk=int(sum([
comp.capacityInKB for comp in
obj.config.hardware.device
if isinstance(comp, vim.vm.device.VirtualDisk)
]) / 1024 / 1024), # Kilobytes to Gigabytes
vcpus=obj.config.hardware.numCPU,
tags=self.tags
))
results["virtual_machines"].append(nbt.virtual_machine(
name=truncate(obj_name, max_len=64),
cluster=cluster,
status=int(
1 if obj.runtime.powerState == "poweredOn" else 0
),
role="Server",
platform=platform.strip(),
memory=obj.config.hardware.memoryMB,
disk=int(sum([
comp.capacityInKB for comp in
obj.config.hardware.device
if isinstance(comp, vim.vm.device.VirtualDisk)
]) / 1024 / 1024), # Kilobytes to Gigabytes
vcpus=obj.config.hardware.numCPU,
tags=self.tags
))
else:
results["virtual_machines"].append(nbt.virtual_machine(
name=truncate(obj_name, max_len=64),
cluster=cluster,
status=int(
1 if obj.runtime.powerState == "poweredOn" else 0
),
role="Server",
platform=platform,
memory=obj.config.hardware.memoryMB,
disk=int(sum([
comp.capacityInKB for comp in
obj.config.hardware.device
if isinstance(comp, vim.vm.device.VirtualDisk)
]) / 1024 / 1024), # Kilobytes to Gigabytes
vcpus=obj.config.hardware.numCPU,
tags=self.tags
))
# If VMware Tools is not detected then we cannot reliably
# collect interfaces and IP addresses
if platform:
Expand Down