Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractSSHClient login is crashing, if keep_alive_interval is not given as argument #396

Open
Thonuck opened this issue Nov 18, 2021 · 3 comments

Comments

@Thonuck
Copy link

Thonuck commented Nov 18, 2021

If you call the login and no keep_alive_interval, then the keep_alive_inteval is set to None,
with this the following line will not work:

(line 203) keep_alive_interval = int(TimeEntry(keep_alive_interval).value)

@URunDEAD
Copy link
Contributor

URunDEAD commented Jan 5, 2022

Hello @Thonuck ! Thank you for opening an issue. Unfortunately, I was not able to replicate the issue as keep_alive_interval is correctly assigned to 0 given the default 0 seconds parameter.
Might I ask if you were checking the value of the variable with the Evaluate Expression... feature offered by the JetBrains suite? Evaluating an assignment expression always results in a {NoneType} None. But by dessasembling the code at that specific line, we can see that the variable is correctly assigned the value 0 as illustrated in the photo below.

Thank you kindly for your involvement and please let me know if I misunderstood your problem.
image

@Thonuck
Copy link
Author

Thonuck commented Feb 14, 2022

Sorry, I did not see your reply earlier. Here is my more detailed findings:

If you look at the login function of the AbstractSSHClient, you have:

    def login(self, username=None, password=None, allow_agent=False, look_for_keys=False, delay=None, proxy_cmd=None,
              read_config=False, jumphost_connection=None, keep_alive_interval=None):

where keep_alive_interval is set by default to None
The first line of the login function is

        keep_alive_interval = int(TimeEntry(keep_alive_interval).value)

which is then conform with

        keep_alive_interval = int(TimeEntry(None).value)

But this leads to
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

So this will always run in a TypeError, if the value is not given here.

I just checked it like this:
image

Unfortunately, I'm not able to reproduce the use case right now, that this situation occurred.

But maybe setting in general the default value for keep_alive_interval to 0 in the argument list of "login" avoids this situation to occur again.

@URunDEAD
Copy link
Contributor

Hi, @Thonuck!
While what you showed in the picture is true, I have not been able to come up with a scenario where that would happen, because the default value for keep_alive_interval should be '0 seconds' as shown in the image below:

image

That being said, I do consider that there isn't any reason why keep_alive_interval should not be a valid value in the other function definitions, and such I have made a pull request with the specified changes #408 .

Thank you for your cooperation and involvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants