Hi,
I would like to load a session, and test if it's still active or not.
if so, the script use it and keep going, if not, the script connect to vcenter as usual, and save session file for re-using it next time.
Is there an return code for $vim->load_session(session_file => '.mysession');
here is my code:
my $vim = Vim->new(service_url => $service_url);
$vim->load_session(session_file => '.mysession');
######
# here I would like to have something like
######
if ($error) {
$vim->login(user_name => $username, password => $password);
# save session $vim in file .mysession
$vim->save_session(session_file => '.mysession');
}
But as soon as I used an inactive session, script ends with:
Error while testing status of connection 'https://X.X.X.X/sdk/webService': The session is not authenticated.
looked for SessionIsActive, but can't find how to use it
Do you have any clue to help me please?
Rgds