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

Errors in ssh_tty.py's read_prompt method #50

Closed
jeffbrl opened this issue Jun 22, 2016 · 0 comments
Closed

Errors in ssh_tty.py's read_prompt method #50

jeffbrl opened this issue Jun 22, 2016 · 0 comments

Comments

@jeffbrl
Copy link

jeffbrl commented Jun 22, 2016

I believe the code in ssh_tty.py's read_prompt method has several errors. What's puzzling me though is that no one else seems to have encountered an exception when the current code is executed. I see examples on the web with using netconify with ssh.

   def read_prompt(self):
        got = []
        mark_start = datetime.now()
        mark_end = mark_start + timedelta(seconds=15)

        while datetime.now() < mark_end:
            delta = time.time() - start
            time.sleep(0.1)
            rd, wr, err = select([self._chan], [], [], self.SELECT_WAIT)
            sleep(0.05)
<snip>
  1. The start variable should be mark_start
  2. You can't subtract a datetime object from a float
  3. sleep is imported from time currently. The import should be changed to 'from time import sleep, time. Once that change is made, both calls to sleep should be simply sleep.

I'll submit a PR for the fixes.

@jeffbrl jeffbrl mentioned this issue Jun 30, 2016
vnitinv added a commit to vnitinv/py-junos-netconify that referenced this issue Jul 1, 2016
vnitinv added a commit that referenced this issue Jul 1, 2016
fix for #50, cherry picked code from #51
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

1 participant