vmware-scripts icon indicating copy to clipboard operation
vmware-scripts copied to clipboard

vCenterAdvSettingMgmt.pl only works with strings

Open bigd1182 opened this issue 3 years ago • 1 comments

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?

bigd1182 avatar Nov 05 '21 03:11 bigd1182

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 );

bigd1182 avatar Nov 05 '21 06:11 bigd1182