VMware {code} Community
skearney
Enthusiast
Enthusiast

Boolean Values

I have a script that looks at each VM object's

config.extraConfig\["tools.syncTime"] value to see if guest time

synchronization has been enabled. The MOB says that this property value is a 'string' type.

In alpha2, this property returned the string value "true" or "false"

In alpha5 the string is (mistakenly?) converted to a 0 or 1.

Beta is even worse as sometime the value is showing as a string and other times is an int.

foreach my $vm (@$vm_views) {

print "$vm->\{name}\n";

$i++;

foreach my $extraConfig (@\{$vm->->\{extraConfig}}) {

next unless $extraConfig->\{key} eq "tools.syncTime";

print "$extraConfig->\{key}: ";

print "$extraConfig->\{value}\n";

if($extraConfig->\{value} =~ /true/i) {

$status = "ENABLED";

$enabled++;

} else {

$status = "DISABLED";

$disabled++;

}

}

print "Time Sync is $status for $vm->\{name}\n";

}

Reply
0 Kudos
9 Replies
hrobinson
VMware Employee
VMware Employee

A few questions:

a) Are you installing the beta from Windows or Linux?

b) In either case, did you use a custom perl distribution or the supplied distribution (ActiveState)?

c) When you say that the value is sometimes a string and other times an int, then can you give examples of each? Is it specifically "tools.syncTime" or other variables?

Thank you.

Reply
0 Kudos
skearney
Enthusiast
Enthusiast

I'm using the Windows beta but not the 'packaged' beta. I already have ActiveState perl (latest build).

In the code example, the print statement (print extraConfig->value) might print ''1" or it might print '\[true|TRUE]'. I can not find a commonality between the VMs that show one or the other. Browsing the MOB always shows a string.

I have not tested widely enough to know whether it is on just the tools.syncTime property.

Reply
0 Kudos
rbosch
Enthusiast
Enthusiast

If it's a string value, the toolkit doesn't do any sort of conversion of the value -- it should just pass through what's in the VM's config file. And the config file is pretty loosey-goosey about truth and falsity -- 1/true/TRUE can all mean true, and 0/false/FALSE can all mean false.

Can you compare the values returned by the toolkit with the corresponding entries is the VM's config file and check whether they match?

Reply
0 Kudos
skearney
Enthusiast
Enthusiast

Looking through the MOB, each time the value is reported as "true", VIperl displays the value as '1'. When the MOB displays "TRUE", VIPerl also displays as "TRUE".

In the few instances I looked at, the value in the actuacl VMX file is "TRUE". Interesting that the MOB is showing a case change from what's in the VMX file in some VMs.

Reply
0 Kudos
hrobinson
VMware Employee
VMware Employee

Can you give us an example (data item) in the MOB where you saw TRUE vs true?

Thanks

Reply
0 Kudos
skearney
Enthusiast
Enthusiast

MOB

dynamicProperty DynamicProperty[] Unset

dynamicType string Unset

key string "tools.syncTime"

value string "true"

VMX

...

tools.syncTime = "TRUE"

...

Reply
0 Kudos
hrobinson
VMware Employee
VMware Employee

I found it and I will report it as a bug.

H

Reply
0 Kudos
skearney
Enthusiast
Enthusiast

Thank you. So is it in the SDK or the Perl toolkit?

Reply
0 Kudos
hrobinson
VMware Employee
VMware Employee

Perl toolkit.

It's in VIM2Stub.pm. If you look for "true", you'll see the falacy of the code.

H

Reply
0 Kudos