My sys info: Running vCenter v5.0 and using the Perl SDK on a vMA v126.96.36.199 vApp server.
I am trying to modify a perl script to automatically connect to our vCenter server instead of having to call vifptarget before running the script. I have stolen this code from another script:
use VMware::VmaTargetLib; my $target; $target = VmaTargetLib::query_target("vcenterserver.***.****.****"); $target->login();
I have replaced the hostname with the IP of my vCenter server (192.168.1.1 as an example). When I run the script, it prompts for a username and then a password. That is not what I want or expected, so I have messed up somewhere.
If I run "vifptarget -s 192.168.1.1" on the vMA shell as vi-admin, it immediately makes the connection with no prompt for credentials. So I am pretty sure that my fastpass is setup and functioning properly.
The problem I am trying to solve is that when I run my original script that requires vifptarget to be executed before the script, vCenter shows that it logs in twice and those sessions hang around forever it seems. This eats into the 100 session limit of vCenter and causes issues when this script is run multiple times (like, say, during a VDI recompose of dozens of VM's). As far as I can tell, there's no way to close those sessions. The "vifptarget -c" has no effect if i run that at the end of my script.
I am trying to use the VmaTargetLib.login so that on exit I can call VmaTargetLib.close and remove those sessions. If that won't work, I'll have to find some way to make my connection use more efficient.
So my question is, how do I get VmaTargetLib to use the fastpass and not prompt for username and password?