Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vCenterAdvSettingMgmt.pl only works with strings #112

Open
bigd1182 opened this issue Nov 5, 2021 · 1 comment
Open

vCenterAdvSettingMgmt.pl only works with strings #112

bigd1182 opened this issue Nov 5, 2021 · 1 comment

Comments

@bigd1182
Copy link

bigd1182 commented Nov 5, 2021

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
Copy link
Author

bigd1182 commented Nov 5, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant