vmware-scripts
vmware-scripts copied to clipboard
vCenterAdvSettingMgmt.pl only works with strings
Running this script to update a value only works with options that are of string type. When updating an integer, it fails. Can the script be updated to support all of the optionTypes?
As a workaround, added this to get the type dynamically...
my $typeValue; my $refType; my $options = $optionManager->supportedOption; foreach(sort {$a->key cmp $b->key} @$options) { if($_->key eq $key) { print Dumper($_); if ($_->optionType->isa("StringOption")) { $refType = "string"; } elsif ($_->optionType->isa("IntOption")) { $refType = "int"; } elsif ($_->optionType->isa("FloatOption")) { $refType = "float"; } elsif ($_->optionType->isa("LongOption")) { $refType = "long"; } elsif ($_->optionType->isa("ChoiceOption")) { $refType = "string"; } elsif ($_->optionType->isa("BoolOption")) { $refType = "boolean"; } } } $typeValue = new PrimType($value,$refType); my $option = OptionValue->new(key => $key, value => $typeValue );