Having trouble doing this, likely because I don't understand quite what I'm doing. From the UI, you can associate a profile with a cluster. Then, you can right-click on a host within the cluster and do "Apply Profile". Works great, and requires no extra inputs. From the perl SDK, it's not so easy.
From the docs, it looks like it's two steps: (a) ExecuteHostProfile followed by (b) ApplyHostConfig_Task.
So, my code looks like this. First I look up the profile, by name:
die unless defined $profile;
then I apply it like so:
my $res = $profile->ExecuteHostProfile(host => $host);
my $taskRef = $hostProfileManager->ApplyHostConfig_Task(host => $host, configSpec => $res->configSpec);
Using the 4.x API, this fails with "Cannot apply the host configuration". If I take the contents of $res->requireInput (which contains two items) and feed it back into ExecuteHostProfile as a "deferredParam", the resulting configuration doesn't seem to change... I continually get the same two items back in $res->requireInput, regardless how many times I feed them back tino ExecuteHostProfile.
If I use the 5.x API in order to get access to the "userInput" parameter in the ApplyHostConfig_Task call, and pass the same $res->requireInput via that parameter like so:
my $taskRef = $hostProfileManager->ApplyHostConfig_Task(host => $hostObject, configSpec => $res->configSpec, userInput => $res->requireInput);
I get this instead:
Can't call method "serialize" on unblessed reference at .../vsphere-sdk-5.0/lib/VMware/share/VMware/VICommon.pm line 2435.
Can anybody shed some light on how this is supposed to work, and what I might be doing wrong?