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

exceptions.ProbeError should return original error message #8

Open
bobbywatson3 opened this issue Jan 24, 2017 · 3 comments
Open

exceptions.ProbeError should return original error message #8

bobbywatson3 opened this issue Jan 24, 2017 · 3 comments
Assignees

Comments

@bobbywatson3
Copy link
Contributor

Copied from issue opened by @acarpi in aeon-ztps repo:

In bootstrap scripts, when we try to connect to the box after a given init-delay, I got the following error

2017-01-20 22:18:58,107:INFO:172.20.197.7:bootstrap init-delay: 5 seconds
2017-01-20 22:19:03,165:INFO:172.20.197.7:Waiting for device access
2017-01-20 22:19:16,486:INFO:172.20.197.7:rc=1 stdout=
2017-01-20 22:19:16,486:ERROR:172.20.197.7:stderr=Traceback (most recent call last):
  File "/opt/aeonztps/bin/cumulus-bootstrap", line 434, in <module>
    main()
  File "/opt/aeonztps/bin/cumulus-bootstrap", line 424, in main
    dev = wait_for_device(countdown=g_cli_args.reload_delay, poll_delay=10, msg='Waiting for device access')
  File "/opt/aeonztps/bin/cumulus-bootstrap", line 184, in wait_for_device
    timeout=poll_delay)
  File "/usr/local/lib/python2.7/dist-packages/aeon/cumulus/device.py", line 37, in __init__
    self.probe(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/aeon/cumulus/device.py", line 46, in probe
    raise exceptions.ProbeError()
aeon.exceptions.ProbeError

Now, ProbeError can be raised for multiple reasons

  • connection timeout (e.g. box is not up within a given time)
  • connection refused (box doesn't have ssh service up)
  • no route to host
  • ...

I noticed under the hood the code is relying on socket.connect to check if the box is online, but the original exception message is lost. This would be a useful source of information for debugging.

    def probe(self, **kwargs):
        timeout = kwargs.get('timeout') or self.DEFAULT_PROBE_TIMEOUT
        ok, elapsed = probe(self.target, protocol='ssh', timeout=timeout)
        if not ok:
            raise exceptions.ProbeError()
@jeremyschulman
Copy link
Contributor

I should have this fixed early next week; delay due to travel. If needed more urgently please let me know. thank you.

@jeremyschulman
Copy link
Contributor

@bobbywatson3 - any chance one of you other updates resolved this issue?

@bobbywatson3
Copy link
Contributor Author

No. I only updated ConfigError, CommandError, and LoginNotReadyError exceptions. The ProbeError is different from those other exceptions in that it simply passes, whereas the others acted as a wrapper around the underlying exception.

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

No branches or pull requests

2 participants