Hey,
I have just started using the SDK and have a query regarding the opts::validate().
I have implemented perl a script which will loop through an array of vCenters calling a connect subroutine for each vcenter and connect into each one using predefined usernames & passwords.
This works great, however, only if the username & password are correct, if not, the script quits..
I understand that opts::validate, checks all credentials are valid and if not will display an error message & quit.
In a situation where the credentials for a given vcenter may be incorect is there a way to avoid the script quiting and just move on to the next vcenter?
eg : if(opts::validate == true){login}else{next vcenter}
See below for my requirement :
#####
foreach vcenter{
connect(vcenter, vcenterCredentials)
}
#####
sub connect{
Opts::set_option('server', <passed_vcenter>);
Opts::set_option('username', <passed_username>);
Opts::set_option('password', <passed_password>);
#~#
Opts::parse();
Opts::validate(); <------------- if valid:
Util::connect()
### Do stuff ###
Util:: disconnect()
else:
### Break out of sub connect ###
}
Any help would be appreciated.