VMware {code} Community
kri-2
Hot Shot
Hot Shot

viperltoolkit: how to test a session?

Hi,

I just tried the session methods in the vipertoolkit. But I could not get the expected behavior.

I wish I just could test a session if it is active and usable or not. The code below should represent what I mean - use it as flowchart, don't pay attention to the syntax:

sub sessioning{

if(Vim::load_session( service_url => $url, session_file => $file)){

   print "session is active, go ahead!";

   do_some_work();

}

else{

   print "need to start a new session!";

   start_session();

   save_session();

   sessioning();

}

}

Unfortunately the load_session is alway true (even if the session file doesn't exist), so this code would never start a new session. Catching the error with an find_entity_view is too late and costs to much time.

Do I miss something?

Chris

Reply
0 Kudos
5 Replies
SaranshG
Enthusiast
Enthusiast

Which viperltoolkit you are using?

Reply
0 Kudos
hrobinson
VMware Employee
VMware Employee

I am assuming that you are using VI Perl Toolkit beta.

Yes, this is a bug and I filed it.

For now, you would have to do something like:

sub sessioning;

if ($@) {

print "need to start a new session!";

start_session();

save_session();

sessioning();

}

else {

print "session is active, go ahead!";

do_some_work();

}

This is a low cost call and should fail unless you are logged in.

kri-2
Hot Shot
Hot Shot

Hi,

yes i am on viperltoolkit beta-1 - still waiting for the windows sources of beta-2.

Is this bug fixed in Beta-2 or will it be fixed in a later release?

Chris

Reply
0 Kudos
kri-2
Hot Shot
Hot Shot

Hi,

just installed the new viperltoolkit 1.0, but still the same behaviour. Wasn't this bug fixed?

chris

Reply
0 Kudos
jnhall
Enthusiast
Enthusiast

This bug is still open and we won't forget about it. When a fix will be available or what it might be, I can't say.

Reply
0 Kudos